summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <marko@hundin.mysql.fi>2005-01-12 14:08:25 +0200
committerunknown <marko@hundin.mysql.fi>2005-01-12 14:08:25 +0200
commitb895e877724fdd1fe6735fd20a74ea439f486582 (patch)
tree4eec3dc026c118a91fb5221591634c9a4dbce658 /ndb
parent267407e4ab0c2a1089f3f4e19fe5b1ee76116e35 (diff)
parente8e48614012d968d59606d4994d9e3ab6aa61eee (diff)
downloadmariadb-git-b895e877724fdd1fe6735fd20a74ea439f486582.tar.gz
Merge marko@bk-internal.mysql.com:/home/bk/mysql-4.1
into hundin.mysql.fi:/home/marko/k/mysql-4.1 innobase/include/row0mysql.h: Auto merged innobase/row/row0sel.c: Auto merged sql/ha_innodb.cc: Auto merged
Diffstat (limited to 'ndb')
-rw-r--r--ndb/config/type_ndbapitest.mk.am2
-rw-r--r--ndb/include/Makefile.am1
-rw-r--r--ndb/include/kernel/signaldata/DictTabInfo.hpp14
-rw-r--r--ndb/include/logger/LogHandler.hpp31
-rw-r--r--ndb/include/logger/Logger.hpp2
-rw-r--r--ndb/include/ndb_global.h.in58
-rw-r--r--ndb/include/ndb_init.h32
-rw-r--r--ndb/include/ndb_types.h36
-rw-r--r--ndb/include/ndbapi/NdbApi.hpp2
-rw-r--r--ndb/include/ndbapi/NdbBlob.hpp15
-rw-r--r--ndb/include/ndbapi/NdbDictionary.hpp5
-rw-r--r--ndb/include/ndbapi/NdbReceiver.hpp3
-rw-r--r--ndb/include/ndbapi/ndb_cluster_connection.hpp58
-rw-r--r--ndb/include/transporter/TransporterDefinitions.hpp2
-rw-r--r--ndb/include/transporter/TransporterRegistry.hpp7
-rw-r--r--ndb/include/util/NdbSqlUtil.hpp8
-rw-r--r--ndb/include/util/ndb_opts.h2
-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/portlib/NdbThread.c4
-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.cpp8
-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.cpp154
-rw-r--r--ndb/src/common/util/NdbSqlUtil.cpp109
-rw-r--r--ndb/src/kernel/blocks/backup/Backup.cpp6
-rw-r--r--ndb/src/kernel/blocks/dbtc/DbtcMain.cpp28
-rw-r--r--ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp74
-rw-r--r--ndb/src/kernel/blocks/suma/Suma.cpp11
-rw-r--r--ndb/src/kernel/main.cpp2
-rw-r--r--ndb/src/mgmsrv/InitConfigFileParser.cpp12
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.cpp37
-rw-r--r--ndb/src/mgmsrv/main.cpp12
-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/NdbDictionary.cpp7
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp18
-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
-rw-r--r--ndb/test/include/NdbSchemaOp.hpp3
-rw-r--r--ndb/test/ndbapi/testBlobs.cpp13
-rw-r--r--ndb/test/ndbapi/testOIBasic.cpp11
-rw-r--r--ndb/test/run-test/main.cpp1
-rw-r--r--ndb/test/src/CpcClient.cpp42
-rw-r--r--ndb/tools/restore/consumer.cpp5
53 files changed, 771 insertions, 391 deletions
diff --git a/ndb/config/type_ndbapitest.mk.am b/ndb/config/type_ndbapitest.mk.am
index f1fd8286337..392c4e9fc70 100644
--- a/ndb/config/type_ndbapitest.mk.am
+++ b/ndb/config/type_ndbapitest.mk.am
@@ -5,7 +5,7 @@ LDADD += $(top_builddir)/ndb/test/src/libNDBT.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
-INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \
+INCLUDES += -I$(top_srcdir) -I$(top_srcdir)/include \
-I$(top_srcdir)/ndb/include \
-I$(top_srcdir)/ndb/include/ndbapi \
-I$(top_srcdir)/ndb/include/util \
diff --git a/ndb/include/Makefile.am b/ndb/include/Makefile.am
index b29433a59b7..38b9d870fbc 100644
--- a/ndb/include/Makefile.am
+++ b/ndb/include/Makefile.am
@@ -2,6 +2,7 @@
include $(top_srcdir)/ndb/config/common.mk.am
ndbinclude_HEADERS = \
+ndb_init.h \
ndb_types.h \
ndb_version.h
diff --git a/ndb/include/kernel/signaldata/DictTabInfo.hpp b/ndb/include/kernel/signaldata/DictTabInfo.hpp
index ae78c023c2a..3e73ae67ebe 100644
--- a/ndb/include/kernel/signaldata/DictTabInfo.hpp
+++ b/ndb/include/kernel/signaldata/DictTabInfo.hpp
@@ -308,9 +308,10 @@ public:
ExtBinary = NdbSqlUtil::Type::Binary,
ExtVarbinary = NdbSqlUtil::Type::Varbinary,
ExtDatetime = NdbSqlUtil::Type::Datetime,
- ExtTimespec = NdbSqlUtil::Type::Timespec,
+ ExtDate = NdbSqlUtil::Type::Date,
ExtBlob = NdbSqlUtil::Type::Blob,
- ExtText = NdbSqlUtil::Type::Text
+ ExtText = NdbSqlUtil::Type::Text,
+ ExtTime = NdbSqlUtil::Type::Time
};
// Attribute data interpretation
@@ -428,10 +429,10 @@ public:
AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = 8 * AttributeExtLength;
return true;
- case DictTabInfo::ExtTimespec:
+ case DictTabInfo::ExtDate:
AttributeType = DictTabInfo::StringType;
AttributeSize = DictTabInfo::an8Bit;
- AttributeArraySize = 12 * AttributeExtLength;
+ AttributeArraySize = 3 * AttributeExtLength;
return true;
case DictTabInfo::ExtBlob:
case DictTabInfo::ExtText:
@@ -440,6 +441,11 @@ public:
// head + inline part [ attr precision lower half ]
AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF);
return true;
+ case DictTabInfo::ExtTime:
+ AttributeType = DictTabInfo::StringType;
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = 3 * AttributeExtLength;
+ return true;
};
return false;
}
diff --git a/ndb/include/logger/LogHandler.hpp b/ndb/include/logger/LogHandler.hpp
index ca4bd4c0668..7df6ad864e5 100644
--- a/ndb/include/logger/LogHandler.hpp
+++ b/ndb/include/logger/LogHandler.hpp
@@ -19,7 +19,6 @@
#include "Logger.hpp"
-
/**
* This class is the base class for all log handlers. A log handler is
* responsible for formatting and writing log messages to a specific output.
@@ -68,7 +67,8 @@ public:
/**
* Append a log message to the output stream/file whatever.
* append() will call writeHeader(), writeMessage() and writeFooter() for
- * a child class and in that order.
+ * a child class and in that order. Append checks for repeated messages.
+ * append_impl() does not check for repeats.
*
* @param pCategory the category/name to tag the log entry with.
* @param level the log level.
@@ -76,6 +76,8 @@ public:
*/
void append(const char* pCategory, Logger::LoggerLevel level,
const char* pMsg);
+ void append_impl(const char* pCategory, Logger::LoggerLevel level,
+ const char* pMsg);
/**
* Returns a default formatted header. It currently has the
@@ -112,14 +114,6 @@ public:
void setDateTimeFormat(const char* pFormat);
/**
- * Returns a string date and time string.
- *
- * @param pStr a string.
- * @return a string with date and time.
- */
- char* getTimeAsString(char* pStr) const;
-
- /**
* Returns the error code.
*/
int getErrorCode() const;
@@ -185,6 +179,15 @@ protected:
virtual void writeFooter() = 0;
private:
+ /**
+ * Returns a string date and time string.
+ * @note does not update time, uses m_now as time
+ * @param pStr a string.
+ * @return a string with date and time.
+ */
+ char* getTimeAsString(char* pStr) const;
+ time_t m_now;
+
/** Prohibit */
LogHandler(const LogHandler&);
LogHandler* operator = (const LogHandler&);
@@ -192,6 +195,14 @@ private:
const char* m_pDateTimeFormat;
int m_errorCode;
+
+ // for handling repeated messages
+ unsigned m_count_repeated_messages;
+ unsigned m_max_repeat_frequency;
+ time_t m_last_log_time;
+ char m_last_category[MAX_HEADER_LENGTH];
+ char m_last_message[MAX_LOG_MESSAGE_SIZE];
+ Logger::LoggerLevel m_last_level;
};
#endif
diff --git a/ndb/include/logger/Logger.hpp b/ndb/include/logger/Logger.hpp
index f12297023b7..ee762098fb6 100644
--- a/ndb/include/logger/Logger.hpp
+++ b/ndb/include/logger/Logger.hpp
@@ -20,6 +20,8 @@
#include <ndb_global.h>
#include <BaseString.hpp>
+#define MAX_LOG_MESSAGE_SIZE 1024
+
class LogHandler;
class LogHandlerList;
diff --git a/ndb/include/ndb_global.h.in b/ndb/include/ndb_global.h.in
index aefb319730c..d7a5cb1b1cf 100644
--- a/ndb/include/ndb_global.h.in
+++ b/ndb/include/ndb_global.h.in
@@ -1,3 +1,18 @@
+/* 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 NDBGLOBAL_H
#define NDBGLOBAL_H
@@ -16,12 +31,48 @@
#define HAVE_STRCASECMP
#define strcasecmp _strcmpi
#pragma warning(disable: 4503 4786)
+typedef unsigned __int64 Uint64;
+typedef signed __int64 Int64;
#else
#undef NDB_WIN32
#define DIR_SEPARATOR "/"
+typedef unsigned long long Uint64;
+typedef signed long long Int64;
#endif
#include <my_global.h>
+
+typedef signed char Int8;
+typedef unsigned char Uint8;
+typedef signed short Int16;
+typedef unsigned short Uint16;
+typedef signed int Int32;
+typedef unsigned int Uint32;
+
+typedef unsigned int UintR;
+
+#ifdef __SIZE_TYPE__
+typedef __SIZE_TYPE__ UintPtr;
+#elif SIZEOF_CHARP == 4
+typedef Uint32 UintPtr;
+#elif SIZEOF_CHARP == 8
+typedef Uint64 UintPtr;
+#else
+#error "Unknown size of (char *)"
+#endif
+
+#if ! (SIZEOF_CHAR == 1)
+#error "Invalid define for Uint8"
+#endif
+
+#if ! (SIZEOF_INT == 4)
+#error "Invalid define for Uint32"
+#endif
+
+#if ! (SIZEOF_LONG_LONG == 8)
+#error "Invalid define for Uint64"
+#endif
+
#include <my_alarm.h>
#ifdef _AIX
@@ -96,15 +147,12 @@ extern "C" {
#include <assert.h>
-/* call in main() - does not return on error */
-extern int ndb_init(void);
-extern void ndb_end(int);
-#define NDB_INIT(prog_name) {my_progname=(prog_name); ndb_init();}
-
#ifdef __cplusplus
}
#endif
+#include "ndb_init.h"
+
#ifdef SCO
#ifndef PATH_MAX
diff --git a/ndb/include/ndb_init.h b/ndb/include/ndb_init.h
new file mode 100644
index 00000000000..0ff53e6a2af
--- /dev/null
+++ b/ndb/include/ndb_init.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+#ifndef NDB_INIT_H
+#define NDB_INIT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* call in main() - does not return on error */
+extern int ndb_init(void);
+extern void ndb_end(int);
+#define NDB_INIT(prog_name) {my_progname=(prog_name); ndb_init();}
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ndb/include/ndb_types.h b/ndb/include/ndb_types.h
index 0d603cc2ab3..6cf9bb40d7f 100644
--- a/ndb/include/ndb_types.h
+++ b/ndb/include/ndb_types.h
@@ -21,40 +21,6 @@
#ifndef NDB_TYPES_H
#define NDB_TYPES_H
-typedef signed char Int8;
-typedef unsigned char Uint8;
-typedef signed short Int16;
-typedef unsigned short Uint16;
-typedef signed int Int32;
-typedef unsigned int Uint32;
-
-typedef unsigned int UintR;
-
-#ifdef __SIZE_TYPE__
-typedef __SIZE_TYPE__ UintPtr;
-#else
-#include <ndb_global.h>
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-#if defined(WIN32) || defined(NDB_WIN32)
-typedef Uint32 UintPtr;
-#else
-typedef uintptr_t UintPtr;
-#endif
-#endif
-
-#if defined(WIN32) || defined(NDB_WIN32)
-typedef unsigned __int64 Uint64;
-typedef signed __int64 Int64;
-typedef UintPtr ssize_t;
-#else
-typedef unsigned long long Uint64;
-typedef signed long long Int64;
-#endif
-
+#include "ndb_global.h"
#endif
diff --git a/ndb/include/ndbapi/NdbApi.hpp b/ndb/include/ndbapi/NdbApi.hpp
index add733cccd7..ae7025f560a 100644
--- a/ndb/include/ndbapi/NdbApi.hpp
+++ b/ndb/include/ndbapi/NdbApi.hpp
@@ -17,6 +17,8 @@
#ifndef NdbApi_H
#define NdbApi_H
+#include "ndb_init.h"
+#include "ndb_cluster_connection.hpp"
#include "ndbapi_limits.h"
#include "Ndb.hpp"
#include "NdbConnection.hpp"
diff --git a/ndb/include/ndbapi/NdbBlob.hpp b/ndb/include/ndbapi/NdbBlob.hpp
index 0fb63015da2..b145c69b04b 100644
--- a/ndb/include/ndbapi/NdbBlob.hpp
+++ b/ndb/include/ndbapi/NdbBlob.hpp
@@ -182,27 +182,12 @@ public:
/**
* Get blob parts table name. Useful only to test programs.
*/
- STATIC_CONST( BlobTableNameSize = 40 );
static int getBlobTableName(char* btname, Ndb* anNdb, const char* tableName, const char* columnName);
/**
* Return error object. The error may be blob specific (below) or may
* be copied from a failed implicit operation.
*/
const NdbError& getNdbError() const;
- // "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 );
/**
* Return info about all blobs in this operation.
*/
diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp
index f0c8a10f488..454b267d1b0 100644
--- a/ndb/include/ndbapi/NdbDictionary.hpp
+++ b/ndb/include/ndbapi/NdbDictionary.hpp
@@ -185,9 +185,10 @@ public:
Binary, ///< Len
Varbinary, ///< Max len
Datetime, ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes )
- Timespec, ///< Precision down to 1 nsec(sizeof(Datetime) == 12 bytes )
+ Date, ///< Precision down to 1 day(sizeof(Date) == 4 bytes )
Blob, ///< Binary large object (see NdbBlob)
- Text ///< Text blob
+ Text, ///< Text blob
+ Time = 25 ///< Time without date
};
/**
diff --git a/ndb/include/ndbapi/NdbReceiver.hpp b/ndb/include/ndbapi/NdbReceiver.hpp
index b95313db274..af624f69bd3 100644
--- a/ndb/include/ndbapi/NdbReceiver.hpp
+++ b/ndb/include/ndbapi/NdbReceiver.hpp
@@ -19,7 +19,6 @@
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL // Not part of public interface
#include <ndb_types.h>
-#include <ndb_global.h>
class Ndb;
class NdbConnection;
@@ -131,7 +130,9 @@ int
NdbReceiver::execTCOPCONF(Uint32 len){
Uint32 tmp = m_received_result_length;
m_expected_result_length = len;
+#ifdef assert
assert(!(tmp && !len));
+#endif
return ((bool)len ^ (bool)tmp ? 0 : 1);
}
diff --git a/ndb/include/ndbapi/ndb_cluster_connection.hpp b/ndb/include/ndbapi/ndb_cluster_connection.hpp
index 1b1c8575656..0e559700716 100644
--- a/ndb/include/ndbapi/ndb_cluster_connection.hpp
+++ b/ndb/include/ndbapi/ndb_cluster_connection.hpp
@@ -18,28 +18,72 @@
#ifndef CLUSTER_CONNECTION_HPP
#define CLUSTER_CONNECTION_HPP
-struct Ndb_cluster_connection_node_iter;
-
+/**
+ * @class Ndb_cluster_connection
+ * @brief Represents a connection to a cluster of storage nodes
+ *
+ * Always start your application program by creating a
+ * Ndb_cluster_connection object. Your application should contain
+ * only one Ndb_cluster_connection. Your application connects to
+ * a cluster management server when method connect() is called.
+ * With the method wait_until_ready() it is possible to wait
+ * for the connection to one or several storage nodes.
+ */
class Ndb_cluster_connection {
public:
+ /**
+ * Create a connection to a cluster of storage nodes
+ *
+ * @param specify the connectstring for where to find the
+ * management server
+ */
Ndb_cluster_connection(const char * connect_string = 0);
~Ndb_cluster_connection();
- int connect(int no_retries, int retry_delay_in_seconds, int verbose);
+
+ /**
+ * Connect to a cluster management server
+ *
+ * @param no_retries specifies the number of retries to perform
+ * if the connect fails, negative number results in infinite
+ * number of retries
+ * @param retry_delay_in_seconds specifies how often retries should
+ * be performed
+ * @param verbose specifies if the method should print progess
+ *
+ * @return 0 if success,
+ * 1 if retriable error,
+ * -1 if non-retriable error
+ */
+ int connect(int no_retries=0, int retry_delay_in_seconds=1, int verbose=0);
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
int start_connect_thread(int (*connect_callback)(void)= 0);
+#endif
- // add check coupled to init state of cluster connection
- // timeout_after_first_alive negative - ok only if all alive
- // timeout_after_first_alive positive - ok if some alive
+ /**
+ * Wait until one or several storage nodes are connected
+ *
+ * @param time_out_for_first_alive number of seconds to wait until
+ * first alive node is detected
+ * @param timeout_after_first_alive number of seconds to wait after
+ * first alive node is detected
+ *
+ * @return 0 all nodes alive,
+ * > 0 at least one node alive,
+ * < 0 error
+ */
int wait_until_ready(int timeout_for_first_alive,
int timeout_after_first_alive);
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
const char *get_connectstring(char *buf, int buf_sz) const;
int get_connected_port() const;
const char *get_connected_host() const;
void set_optimized_node_selection(int val);
- Uint32 no_db_nodes();
+ unsigned no_db_nodes();
+#endif
private:
friend class Ndb;
diff --git a/ndb/include/transporter/TransporterDefinitions.hpp b/ndb/include/transporter/TransporterDefinitions.hpp
index a8da8068552..4ff6b2073eb 100644
--- a/ndb/include/transporter/TransporterDefinitions.hpp
+++ b/ndb/include/transporter/TransporterDefinitions.hpp
@@ -68,6 +68,8 @@ struct TCP_TransporterConfiguration {
*/
struct SHM_TransporterConfiguration {
Uint32 port;
+ const char *remoteHostName;
+ const char *localHostName;
NodeId remoteNodeId;
NodeId localNodeId;
bool checksum;
diff --git a/ndb/include/transporter/TransporterRegistry.hpp b/ndb/include/transporter/TransporterRegistry.hpp
index 96da7eef2cb..7487d6b1e80 100644
--- a/ndb/include/transporter/TransporterRegistry.hpp
+++ b/ndb/include/transporter/TransporterRegistry.hpp
@@ -99,7 +99,12 @@ public:
unsigned sizeOfLongSignalMemory = 100);
bool init(NodeId localNodeId);
-
+
+ /**
+ * after a connect from client, perform connection using correct transporter
+ */
+ bool connect_server(NDB_SOCKET_TYPE sockfd);
+
/**
* Remove all transporters
*/
diff --git a/ndb/include/util/NdbSqlUtil.hpp b/ndb/include/util/NdbSqlUtil.hpp
index 3062d1e4e1b..10024d9b616 100644
--- a/ndb/include/util/NdbSqlUtil.hpp
+++ b/ndb/include/util/NdbSqlUtil.hpp
@@ -81,9 +81,10 @@ public:
Binary, // Len
Varbinary, // Max len
Datetime, // Precision down to 1 sec (size 8 bytes)
- Timespec, // Precision down to 1 nsec (size 12 bytes)
+ Date, // Precision down to 1 day (size 4 bytes)
Blob, // Blob
- Text // Text blob
+ Text, // Text blob
+ Time = 25 // Time without date
};
Enum m_typeId;
Cmp* m_cmp; // comparison method
@@ -132,9 +133,10 @@ private:
static Cmp cmpBinary;
static Cmp cmpVarbinary;
static Cmp cmpDatetime;
- static Cmp cmpTimespec;
+ static Cmp cmpDate;
static Cmp cmpBlob;
static Cmp cmpText;
+ static Cmp cmpTime;
};
#endif
diff --git a/ndb/include/util/ndb_opts.h b/ndb/include/util/ndb_opts.h
index 4bac36f5e5e..dc95149f706 100644
--- a/ndb/include/util/ndb_opts.h
+++ b/ndb/include/util/ndb_opts.h
@@ -34,7 +34,7 @@ OPT_NDB_OPTIMIZED_NODE_SELECTION
#define OPT_NDB_CONNECTSTRING 'c'
-#ifdef NDB_SHM_TRANSPORTER
+#if defined(NDB_SHM_TRANSPORTER) && MYSQL_VERSION_ID >= 50000
#define OPT_NDB_SHM_DEFAULT 1
#else
#define OPT_NDB_SHM_DEFAULT 0
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/portlib/NdbThread.c b/ndb/src/common/portlib/NdbThread.c
index 69e39994a9c..d4f6617d2f5 100644
--- a/ndb/src/common/portlib/NdbThread.c
+++ b/ndb/src/common/portlib/NdbThread.c
@@ -54,7 +54,11 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
strnmov(tmpThread->thread_name,p_thread_name,sizeof(tmpThread->thread_name));
pthread_attr_init(&thread_attr);
+#if (SIZEOF_CHARP == 8)
+ pthread_attr_setstacksize(&thread_attr, 2*thread_stack_size);
+#else
pthread_attr_setstacksize(&thread_attr, thread_stack_size);
+#endif
#ifdef USE_PTHREAD_EXTRAS
/* Guard stack overflow with a 2k databuffer */
pthread_attr_setguardsize(&thread_attr, 2048);
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..f0cbf822e53 100644
--- a/ndb/src/common/transporter/SHM_Transporter.cpp
+++ b/ndb/src/common/transporter/SHM_Transporter.cpp
@@ -26,8 +26,6 @@
#include <InputStream.hpp>
#include <OutputStream.hpp>
-extern int g_shm_pid;
-
SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg,
const char *lHostName,
const char *rHostName,
@@ -38,7 +36,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 +255,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..c80e6bc1489 100644
--- a/ndb/src/common/transporter/TransporterRegistry.cpp
+++ b/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -47,7 +47,8 @@
#include <InputStream.hpp>
#include <OutputStream.hpp>
-int g_shm_pid = 0;
+#include <EventLogger.hpp>
+extern EventLogger g_eventLogger;
SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd)
{
@@ -57,49 +58,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 +158,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 +405,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,
@@ -1273,7 +1320,22 @@ TransporterRegistry::startReceiving()
#ifdef NDB_SHM_TRANSPORTER
m_shm_own_pid = getpid();
- signal(SIGUSR1, shm_sig_handler);
+ struct sigaction sa;
+ sa.sa_handler = shm_sig_handler;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ int ret;
+ while((ret = sigaction(SIGUSR1, &sa, 0)) == -1 && errno == EINTR);
+ if(ret != 0)
+ {
+ g_eventLogger.error("Failed to install signal handler for SHM transporter"
+ " errno: %d (%s)", errno,
+#ifdef HAVE_STRERROR
+ strerror(errno));
+#else
+ "");
+#endif
+ }
#endif
}
diff --git a/ndb/src/common/util/NdbSqlUtil.cpp b/ndb/src/common/util/NdbSqlUtil.cpp
index 5b2381df50a..233698ae52b 100644
--- a/ndb/src/common/util/NdbSqlUtil.cpp
+++ b/ndb/src/common/util/NdbSqlUtil.cpp
@@ -153,8 +153,8 @@ NdbSqlUtil::m_typeList[] = {
cmpDatetime
},
{
- Type::Timespec,
- cmpTimespec
+ Type::Date,
+ cmpDate
},
{
Type::Blob,
@@ -163,6 +163,22 @@ NdbSqlUtil::m_typeList[] = {
{
Type::Text,
cmpText
+ },
+ {
+ Type::Undefined, // 5.0 Bit
+ NULL
+ },
+ {
+ Type::Undefined, // 5.0 Longvarchar
+ NULL
+ },
+ {
+ Type::Undefined, // 5.0 Longvarbinary
+ NULL
+ },
+ {
+ Type::Time,
+ cmpTime
}
};
@@ -469,56 +485,50 @@ int
NdbSqlUtil::cmpDatetime(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size)
{
assert(full >= size && size > 0);
- /*
- * Datetime is CC YY MM DD hh mm ss \0
- *
- * Not used via MySQL.
- */
- union { const Uint32* p; const unsigned char* v; } u1, u2;
- u1.p = p1;
- u2.p = p2;
- // no format check
- int k = memcmp(u1.v, u2.v, 4);
- if (k != 0)
- return k < 0 ? -1 : +1;
if (size >= 2) {
- k = memcmp(u1.v + 4, u2.v + 4, 4);
- return k < 0 ? -1 : k > 0 ? +1 : 0;
+ union { Uint32 p[2]; Int64 v; } u1, u2;
+ u1.p[0] = p1[0];
+ u1.p[1] = p1[1];
+ u2.p[0] = p2[0];
+ u2.p[1] = p2[1];
+ if (u1.v < u2.v)
+ return -1;
+ if (u1.v > u2.v)
+ return +1;
+ return 0;
}
return CmpUnknown;
}
int
-NdbSqlUtil::cmpTimespec(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size)
+NdbSqlUtil::cmpDate(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size)
{
+#ifdef ndb_date_is_4_byte_native_int
+ assert(full >= size && size > 0);
+ union { Uint32 p[2]; Int32 v; } u1, u2;
+ u1.p[0] = p1[0];
+ u2.p[0] = p2[0];
+ if (u1.v < u2.v)
+ return -1;
+ if (u1.v > u2.v)
+ return +1;
+ return 0;
+#else
assert(full >= size && size > 0);
- /*
- * Timespec is CC YY MM DD hh mm ss \0 NN NN NN NN
- *
- * Not used via MySQL.
- */
union { const Uint32* p; const unsigned char* v; } u1, u2;
u1.p = p1;
u2.p = p2;
- // no format check
- int k = memcmp(u1.v, u2.v, 4);
- if (k != 0)
- return k < 0 ? -1 : +1;
- if (size >= 2) {
- k = memcmp(u1.v + 4, u2.v + 4, 4);
- if (k != 0)
- return k < 0 ? -1 : +1;
- if (size >= 3) {
- Uint32 n1 = *(const Uint32*)(u1.v + 8);
- Uint32 n2 = *(const Uint32*)(u2.v + 8);
- if (n1 < n2)
- return -1;
- if (n2 > n1)
- return +1;
- return 0;
- }
- }
- return CmpUnknown;
+ // from Field_newdate::val_int
+ Uint64 j1 = uint3korr(u1.v);
+ Uint64 j2 = uint3korr(u2.v);
+ j1 = (j1 % 32L)+(j1 / 32L % 16L)*100L + (j1/(16L*32L))*10000L;
+ j2 = (j2 % 32L)+(j2 / 32L % 16L)*100L + (j2/(16L*32L))*10000L;
+ if (j1 < j2)
+ return -1;
+ if (j1 > j2)
+ return +1;
+ return 0;
+#endif
}
int
@@ -565,6 +575,23 @@ NdbSqlUtil::cmpText(const void* info, const Uint32* p1, const Uint32* p2, Uint32
return CmpUnknown;
}
+int
+NdbSqlUtil::cmpTime(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size)
+{
+ assert(full >= size && size > 0);
+ union { const Uint32* p; const unsigned char* v; } u1, u2;
+ u1.p = p1;
+ u2.p = p2;
+ // from Field_time::val_int
+ Int32 j1 = sint3korr(u1.v);
+ Int32 j2 = sint3korr(u2.v);
+ if (j1 < j2)
+ return -1;
+ if (j1 > j2)
+ return +1;
+ return 0;
+}
+
// check charset
bool
diff --git a/ndb/src/kernel/blocks/backup/Backup.cpp b/ndb/src/kernel/blocks/backup/Backup.cpp
index 07aeb771c97..d72efdd0a52 100644
--- a/ndb/src/kernel/blocks/backup/Backup.cpp
+++ b/ndb/src/kernel/blocks/backup/Backup.cpp
@@ -992,7 +992,11 @@ Backup::execUTIL_SEQUENCE_CONF(Signal* signal)
}//if
ndbrequire(ptr.p->masterData.state.getState() == DEFINING);
- ptr.p->backupId = conf->sequenceValue[0];
+ {
+ Uint64 backupId;
+ memcpy(&backupId,conf->sequenceValue,8);
+ ptr.p->backupId= (Uint32)backupId;
+ }
ptr.p->backupKey[0] = (getOwnNodeId() << 16) | (ptr.p->backupId & 0xFFFF);
ptr.p->backupKey[1] = NdbTick_CurrentMillisecond();
diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
index dd1252b76b9..815d6c9d838 100644
--- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
+++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
@@ -1879,7 +1879,6 @@ void Dbtc::packKeyData000Lab(Signal* signal,
Uint32 totalLen)
{
CacheRecord * const regCachePtr = cachePtr.p;
- UintR Tmp;
jam();
Uint32 len = 0;
@@ -8503,14 +8502,16 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
apiConnectptr.i = scanTabReq->apiConnectPtr;
tabptr.i = scanTabReq->tableId;
- if (apiConnectptr.i >= capiConnectFilesize ||
- tabptr.i >= ctabrecFilesize) {
+ if (apiConnectptr.i >= capiConnectFilesize)
+ {
jam();
warningHandlerLab(signal);
return;
}//if
+
ptrAss(apiConnectptr, apiConnectRecord);
ApiConnectRecord * transP = apiConnectptr.p;
+
if (transP->apiConnectstate != CS_CONNECTED) {
jam();
// could be left over from TCKEYREQ rollback
@@ -8524,9 +8525,16 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
} else {
jam();
errCode = ZSTATE_ERROR;
- goto SCAN_TAB_error;
+ goto SCAN_TAB_error_no_state_change;
}
}
+
+ if(tabptr.i >= ctabrecFilesize)
+ {
+ errCode = ZUNKNOWN_TABLE_ERROR;
+ goto SCAN_TAB_error;
+ }
+
ptrAss(tabptr, tableRecord);
if ((aiLength == 0) ||
(!tabptr.p->checkTable(schemaVersion)) ||
@@ -8621,8 +8629,18 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
errCode = ZNO_SCANREC_ERROR;
goto SCAN_TAB_error;
- SCAN_TAB_error:
+SCAN_TAB_error:
jam();
+ /**
+ * Prepare for up coming ATTRINFO/KEYINFO
+ */
+ transP->apiConnectstate = CS_ABORTING;
+ transP->abortState = AS_IDLE;
+ transP->transid[0] = transid1;
+ transP->transid[1] = transid2;
+
+SCAN_TAB_error_no_state_change:
+
ScanTabRef * ref = (ScanTabRef*)&signal->theData[0];
ref->apiConnectPtr = transP->ndbapiConnect;
ref->transId1 = transid1;
diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
index a02bfd459b3..ddf1681479c 100644
--- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
+++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
@@ -14,19 +14,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-/**
- * O_DIRECT
- */
-#if 0
-//#ifdef NDB_LINUX
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#endif
-
#include <ndb_global.h>
+#include <my_sys.h>
+#include <my_pthread.h>
-#include "Error.hpp"
+#include <Error.hpp>
#include "AsyncFile.hpp"
#include <ErrorHandlingMacros.hpp>
@@ -35,13 +27,12 @@
#include <NdbThread.h>
#include <signaldata/FsOpenReq.hpp>
-#if 0
-#ifdef HAVE_PREAD
-// This is for pread and pwrite
-#ifndef __USE_UNIX98
-#define __USE_UNIX98
-#endif
-#endif
+// use this to test broken pread code
+//#define HAVE_BROKEN_PREAD
+
+#ifdef HAVE_BROKEN_PREAD
+#undef HAVE_PWRITE
+#undef HAVE_PREAD
#endif
#if defined NDB_WIN32 || defined NDB_OSE || defined NDB_SOFTOSE
@@ -91,6 +82,7 @@ static int numAsyncFiles = 0;
extern "C" void * runAsyncFile(void* arg)
{
+ my_thread_init();
((AsyncFile*)arg)->run();
return (NULL);
}
@@ -395,9 +387,12 @@ AsyncFile::readBuffer(char * buf, size_t size, off_t offset){
if(dwSFP != offset) {
return GetLastError();
}
-#elif defined NDB_OSE || defined NDB_SOFTOSE
- return_value = lseek(theFd, offset, SEEK_SET);
- if (return_value != offset) {
+#elif ! defined(HAVE_PREAD)
+ off_t seek_val;
+ while((seek_val= lseek(theFd, offset, SEEK_SET)) == (off_t)-1
+ && errno == EINTR);
+ if(seek_val == (off_t)-1)
+ {
return errno;
}
#endif
@@ -416,7 +411,7 @@ AsyncFile::readBuffer(char * buf, size_t size, off_t offset){
return GetLastError();
}
bytes_read = dwBytesRead;
-#elif defined NDB_OSE || defined NDB_SOFTOSE
+#elif ! defined(HAVE_PREAD)
return_value = ::read(theFd, buf, size);
#else // UNIX
return_value = ::pread(theFd, buf, size, offset);
@@ -469,7 +464,7 @@ AsyncFile::readReq( Request * request)
void
AsyncFile::readvReq( Request * request)
{
-#if defined NDB_OSE || defined NDB_SOFTOSE
+#if ! defined(HAVE_PREAD)
readReq(request);
return;
#elif defined NDB_WIN32
@@ -499,7 +494,7 @@ AsyncFile::readvReq( Request * request)
int
AsyncFile::extendfile(Request* request) {
-#if defined NDB_OSE || defined NDB_SOFTOSE
+#if ! defined(HAVE_PWRITE)
// Find max size of this file in this request
int maxOffset = 0;
int maxSize = 0;
@@ -608,27 +603,13 @@ AsyncFile::writeBuffer(const char * buf, size_t size, off_t offset,
if(dwSFP != offset) {
return GetLastError();
}
-#elif defined NDB_OSE || defined NDB_SOFTOSE
- return_value = lseek(theFd, offset, SEEK_SET);
- if (return_value != offset) {
- DEBUG(ndbout_c("AsyncFile::writeReq, err1: return_value=%d, offset=%d\n",
- return_value, chunk_offset));
- PRINT_ERRORANDFLAGS(0);
- if (errno == 78) {
- // Could not write beyond end of file, try to extend file
- DEBUG(ndbout_c("AsyncFile::writeReq, Extend. file! filename=\"%s\" \n",
- theFileName.c_str()));
- return_value = extendfile(request);
- if (return_value == -1) {
- return errno;
- }
- return_value = lseek(theFd, offset, SEEK_SET);
- if (return_value != offset) {
- return errno;
- }
- } else {
- return errno;
- }
+#elif ! defined(HAVE_PWRITE)
+ off_t seek_val;
+ while((seek_val= lseek(theFd, offset, SEEK_SET)) == (off_t)-1
+ && errno == EINTR);
+ if(seek_val == (off_t)-1)
+ {
+ return errno;
}
#endif
@@ -650,7 +631,7 @@ AsyncFile::writeBuffer(const char * buf, size_t size, off_t offset,
DEBUG(ndbout_c("Warning partial write %d != %d", bytes_written, bytes_to_write));
}
-#elif defined NDB_OSE || defined NDB_SOFTOSE
+#elif ! defined(HAVE_PWRITE)
return_value = ::write(theFd, buf, bytes_to_write);
#else // UNIX
return_value = ::pwrite(theFd, buf, bytes_to_write, offset);
@@ -889,6 +870,7 @@ void AsyncFile::endReq()
{
// Thread is ended with return
if (theWriteBuffer) NdbMem_Free(theWriteBuffer);
+ my_thread_end();
NdbThread_Exit(0);
}
diff --git a/ndb/src/kernel/blocks/suma/Suma.cpp b/ndb/src/kernel/blocks/suma/Suma.cpp
index 836fa28d9ad..44ac054dd67 100644
--- a/ndb/src/kernel/blocks/suma/Suma.cpp
+++ b/ndb/src/kernel/blocks/suma/Suma.cpp
@@ -824,7 +824,8 @@ Suma::execUTIL_SEQUENCE_CONF(Signal* signal)
return;
}
- Uint32 subId = conf->sequenceValue[0];
+ Uint64 subId;
+ memcpy(&subId,conf->sequenceValue,8);
Uint32 subData = conf->senderData;
SubscriberPtr subbPtr;
@@ -832,8 +833,8 @@ Suma::execUTIL_SEQUENCE_CONF(Signal* signal)
CreateSubscriptionIdConf * subconf = (CreateSubscriptionIdConf*)conf;
- subconf->subscriptionId = subId;
- subconf->subscriptionKey =(getOwnNodeId() << 16) | (subId & 0xFFFF);
+ subconf->subscriptionId = (Uint32)subId;
+ subconf->subscriptionKey =(getOwnNodeId() << 16) | (Uint32)(subId & 0xFFFF);
subconf->subscriberData = subbPtr.p->m_senderData;
sendSignal(subbPtr.p->m_subscriberRef, GSN_CREATE_SUBID_CONF, signal,
@@ -3471,10 +3472,10 @@ SumaParticipant::completeSubRemoveReq(Signal* signal, SubscriptionPtr subPtr) {
*/
#if 0
ndbout_c("c_subscriptionPool.getSize() %d c_subscriptionPool.getNoOfFree()%d",
- c_subscriptionPool.getSize(),c_subscriptionPool.getNoOfFree()+1);
+ c_subscriptionPool.getSize(),c_subscriptionPool.getNoOfFree());
#endif
- if(c_subscriptionPool.getSize() == c_subscriptionPool.getNoOfFree()+1) {
+ if(c_subscriptionPool.getSize() == c_subscriptionPool.getNoOfFree()) {
jam();
#if 0
ndbout_c("SUB_REMOVE_REQ:Clearing c_tables");
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/InitConfigFileParser.cpp b/ndb/src/mgmsrv/InitConfigFileParser.cpp
index 5cc5c3e9b32..822e10c89aa 100644
--- a/ndb/src/mgmsrv/InitConfigFileParser.cpp
+++ b/ndb/src/mgmsrv/InitConfigFileParser.cpp
@@ -228,14 +228,22 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line)
Vector<BaseString> tmp_string_split;
if (BaseString(line).split(tmp_string_split,
- BaseString("=:"),
- 2) != 2)
+ "=:", 2) != 2)
{
ctx.reportError("Parse error");
return false;
}
// *************************************
+ // Remove all after #
+ // *************************************
+
+ Vector<BaseString> tmp_string_split2;
+ tmp_string_split[1].split(tmp_string_split2,
+ "#", 2);
+ tmp_string_split[1]=tmp_string_split2[0];
+
+ // *************************************
// Remove leading and trailing chars
// *************************************
{
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 04c95117214..ce79ccb732b 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;
@@ -161,9 +161,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'V':
print_version();
exit(0);
+#if NDB_VERSION_MAJOR <= 4
case 'c':
printf("Warning: -c will be removed in 5.0, use -f instead\n");
break;
+#endif
case OPT_NDB_SHM:
#ifndef NDB_SHM_TRANSPORTER
printf("Warning: binary not compiled with shared memory support,\n"
@@ -301,12 +303,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();
@@ -322,10 +324,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 da0a4f73c3e..f72361b86ac 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_sizeOfKeysInWords;
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_sizeOfKeysInWords;
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_sizeOfKeysInWords;
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 e2a1b6d6ab9..0a1c7303771 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/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp
index f88bbc907a6..0508d8bf277 100644
--- a/ndb/src/ndbapi/NdbDictionary.cpp
+++ b/ndb/src/ndbapi/NdbDictionary.cpp
@@ -936,8 +936,8 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
case NdbDictionary::Column::Datetime:
out << "Datetime";
break;
- case NdbDictionary::Column::Timespec:
- out << "Timespec";
+ case NdbDictionary::Column::Date:
+ out << "Date";
break;
case NdbDictionary::Column::Blob:
out << "Blob(" << col.getInlineSize() << "," << col.getPartSize()
@@ -947,6 +947,9 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
out << "Text(" << col.getInlineSize() << "," << col.getPartSize()
<< ";" << col.getStripeSize() << ";" << csname << ")";
break;
+ case NdbDictionary::Column::Time:
+ out << "Time";
+ break;
case NdbDictionary::Column::Undefined:
out << "Undefined";
break;
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index 5319e678441..59474943f3b 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>
@@ -129,7 +130,7 @@ NdbColumnImpl::init(Type t)
case Binary:
case Varbinary:
case Datetime:
- case Timespec:
+ case Date:
m_precision = 0;
m_scale = 0;
m_length = 1;
@@ -147,6 +148,12 @@ NdbColumnImpl::init(Type t)
m_length = 4;
m_cs = default_cs;
break;
+ case Time:
+ m_precision = 0;
+ m_scale = 0;
+ m_length = 1;
+ m_cs = NULL;
+ break;
case Undefined:
assert(false);
break;
@@ -1173,9 +1180,10 @@ columnTypeMapping[] = {
{ DictTabInfo::ExtBinary, NdbDictionary::Column::Binary },
{ DictTabInfo::ExtVarbinary, NdbDictionary::Column::Varbinary },
{ DictTabInfo::ExtDatetime, NdbDictionary::Column::Datetime },
- { DictTabInfo::ExtTimespec, NdbDictionary::Column::Timespec },
+ { DictTabInfo::ExtDate, NdbDictionary::Column::Date },
{ DictTabInfo::ExtBlob, NdbDictionary::Column::Blob },
{ DictTabInfo::ExtText, NdbDictionary::Column::Text },
+ { DictTabInfo::ExtTime, NdbDictionary::Column::Time },
{ -1, -1 }
};
@@ -1385,7 +1393,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);
@@ -1793,7 +1801,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 35abb15b00d..c4aaffb3119 100644
--- a/ndb/src/ndbapi/NdbOperationDefine.cpp
+++ b/ndb/src/ndbapi/NdbOperationDefine.cpp
@@ -528,7 +528,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();
diff --git a/ndb/test/include/NdbSchemaOp.hpp b/ndb/test/include/NdbSchemaOp.hpp
index ac859f8abe8..e2fb4015b88 100644
--- a/ndb/test/include/NdbSchemaOp.hpp
+++ b/ndb/test/include/NdbSchemaOp.hpp
@@ -576,7 +576,8 @@ convertColumnTypeToAttrType(NdbDictionary::Column::Type _type)
case NdbDictionary::Column::Varbinary:
return String;
case NdbDictionary::Column::Datetime:
- case NdbDictionary::Column::Timespec:
+ case NdbDictionary::Column::Date:
+ case NdbDictionary::Column::Time:
case NdbDictionary::Column::Undefined:
default:
return NoAttrTypeDef;
diff --git a/ndb/test/ndbapi/testBlobs.cpp b/ndb/test/ndbapi/testBlobs.cpp
index 4b532856709..7b30777456f 100644
--- a/ndb/test/ndbapi/testBlobs.cpp
+++ b/ndb/test/ndbapi/testBlobs.cpp
@@ -23,13 +23,14 @@
#include <NdbOut.hpp>
#include <NdbTest.hpp>
#include <NdbTick.h>
+#include <ndb/src/ndbapi/NdbBlobImpl.hpp>
struct Bcol {
bool m_nullable;
unsigned m_inline;
unsigned m_partsize;
unsigned m_stripe;
- char m_btname[NdbBlob::BlobTableNameSize];
+ char m_btname[NdbBlobImpl::BlobTableNameSize];
Bcol(bool a, unsigned b, unsigned c, unsigned d) :
m_nullable(a),
m_inline(b),
@@ -153,6 +154,7 @@ testcase(char x)
(g_opt.m_skip == 0 || strchr(g_opt.m_skip, x) == 0);
}
+static Ndb_cluster_connection* g_ncc = 0;
static Ndb* g_ndb = 0;
static NdbDictionary::Dictionary* g_dic = 0;
static NdbConnection* g_con = 0;
@@ -1258,7 +1260,7 @@ deleteScan(bool idx)
static int
testmain()
{
- g_ndb = new Ndb("TEST_DB");
+ g_ndb = new Ndb(g_ncc, "TEST_DB");
CHK(g_ndb->init() == 0);
CHK(g_ndb->waitUntilReady() == 0);
g_dic = g_ndb->getDictionary();
@@ -1447,7 +1449,7 @@ testperf()
if (! testcase('p'))
return 0;
DBG("=== perf test ===");
- g_ndb = new Ndb("TEST_DB");
+ g_ndb = new Ndb(g_ncc, "TEST_DB");
CHK(g_ndb->init() == 0);
CHK(g_ndb->waitUntilReady() == 0);
g_dic = g_ndb->getDictionary();
@@ -1859,10 +1861,13 @@ NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
strcat(b, "r");
g_opt.m_skip = strdup(b);
}
- if (testmain() == -1 || testperf() == -1) {
+ g_ncc = new Ndb_cluster_connection();
+ if (g_ncc->connect(30) != 0 || testmain() == -1 || testperf() == -1) {
ndbout << "line " << __LINE__ << " FAIL loop=" << g_loop << endl;
return NDBT_ProgramExit(NDBT_FAILED);
}
+ delete g_ncc;
+ g_ncc = 0;
return NDBT_ProgramExit(NDBT_OK);
}
diff --git a/ndb/test/ndbapi/testOIBasic.cpp b/ndb/test/ndbapi/testOIBasic.cpp
index 41f0686e63b..e6d3844d18e 100644
--- a/ndb/test/ndbapi/testOIBasic.cpp
+++ b/ndb/test/ndbapi/testOIBasic.cpp
@@ -59,7 +59,7 @@ struct Opt {
unsigned m_subloop;
const char* m_table;
unsigned m_threads;
- unsigned m_v;
+ int m_v;
Opt() :
m_batch(32),
m_bound("01234"),
@@ -672,6 +672,8 @@ tabcount = sizeof(tablist) / sizeof(tablist[0]);
// connections
+static Ndb_cluster_connection* g_ncc = 0;
+
struct Con {
Ndb* m_ndb;
NdbDictionary::Dictionary* m_dic;
@@ -720,7 +722,7 @@ int
Con::connect()
{
assert(m_ndb == 0);
- m_ndb = new Ndb("TEST_DB");
+ m_ndb = new Ndb(g_ncc, "TEST_DB");
CHKCON(m_ndb->init() == 0, *this);
CHKCON(m_ndb->waitUntilReady(30) == 0, *this);
m_tx = 0, m_op = 0;
@@ -3514,8 +3516,11 @@ NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535)
}
{
Par par(g_opt);
- if (runtest(par) < 0)
+ g_ncc = new Ndb_cluster_connection();
+ if (g_ncc->connect(30) != 0 || runtest(par) < 0)
goto failed;
+ delete g_ncc;
+ g_ncc = 0;
}
// always exit with NDBT code
ok:
diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp
index ac7710d9546..fb6754dae7a 100644
--- a/ndb/test/run-test/main.cpp
+++ b/ndb/test/run-test/main.cpp
@@ -275,6 +275,7 @@ parse_args(int argc, const char** argv){
int tmp = Logger::LL_WARNING - g_verbosity;
tmp = (tmp < Logger::LL_DEBUG ? Logger::LL_DEBUG : tmp);
g_logger.disable(Logger::LL_ALL);
+ g_logger.enable(Logger::LL_ON);
g_logger.enable((Logger::LoggerLevel)tmp, Logger::LL_ALERT);
}
diff --git a/ndb/test/src/CpcClient.cpp b/ndb/test/src/CpcClient.cpp
index 2ef23528360..1d1b4fcb977 100644
--- a/ndb/test/src/CpcClient.cpp
+++ b/ndb/test/src/CpcClient.cpp
@@ -30,7 +30,7 @@
0, 0, \
0, \
(desc), \
- (void *)(value) }
+ (value) }
#define CPC_ARG(name, type, opt, desc) \
{ (name), \
@@ -351,17 +351,12 @@ SimpleCpcClient::define_process(Process & p, Properties& reply){
int
SimpleCpcClient::list_processes(Vector<Process> &procs, Properties& reply) {
- enum Proclist {
- Proclist_Start,
- Proclist_End,
- Proclist_Entry
- };
+ int start, end, entry;
const ParserRow_t list_reply[] = {
- CPC_CMD("start processes", Proclist_Start, ""),
-
- CPC_CMD("end processes", Proclist_End, ""),
+ CPC_CMD("start processes", &start, ""),
+ CPC_CMD("end processes", &end, ""),
- CPC_CMD("process", Proclist_Entry, ""),
+ CPC_CMD("process", &entry, ""),
CPC_ARG("id", Int, Mandatory, "Id of process."),
CPC_ARG("name", String, Mandatory, "Name of process"),
CPC_ARG("group", String, Mandatory, "Group of process"),
@@ -390,26 +385,29 @@ SimpleCpcClient::list_processes(Vector<Process> &procs, Properties& reply) {
bool done = false;
while(!done) {
const Properties *proc;
- enum Proclist p;
- cpc_recv(list_reply, &proc, (void **)&p);
+ void *p;
+ cpc_recv(list_reply, &proc, &p);
- switch(p) {
- case Proclist_Start:
+ if(p == &start)
+ {
/* do nothing */
- break;
- case Proclist_End:
+ }
+ else if(p == &end)
+ {
done = true;
- break;
- case Proclist_Entry:
+ }
+ else if(p == &entry)
+ {
if(proc != NULL){
Process p;
convert(* proc, p);
procs.push_back(p);
}
- break;
- default:
- /* ignore */
- break;
+ }
+ else
+ {
+ ndbout_c("internal error: %d", __LINE__);
+ return -1;
}
}
return 0;
diff --git a/ndb/tools/restore/consumer.cpp b/ndb/tools/restore/consumer.cpp
index e94c31b2666..4d228230423 100644
--- a/ndb/tools/restore/consumer.cpp
+++ b/ndb/tools/restore/consumer.cpp
@@ -71,7 +71,10 @@ BackupConsumer::create_table_string(const TableS & table,
case NdbDictionary::Column::Datetime:
pos += sprintf(buf+pos, "%s", "datetime");
break;
- case NdbDictionary::Column::Timespec:
+ case NdbDictionary::Column::Date:
+ pos += sprintf(buf+pos, "%s", "date");
+ break;
+ case NdbDictionary::Column::Time:
pos += sprintf(buf+pos, "%s", "time");
break;
case NdbDictionary::Column::Undefined: