Commit 481b314e authored by tomas@whalegate.ndb.mysql.com's avatar tomas@whalegate.ndb.mysql.com

Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0

into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
parents b3a84ddd 709cfbc1
......@@ -28,6 +28,7 @@ EXTRA_DIST = FINISH.sh \
compile-alpha-debug \
compile-amd64-debug-max \
compile-amd64-max \
compile-amd64-max-sci \
compile-darwin-mwcc \
compile-dist \
compile-hpux11-parisc2-aCC \
......@@ -53,6 +54,7 @@ EXTRA_DIST = FINISH.sh \
compile-pentium-valgrind-max \
compile-pentium64-debug \
compile-pentium64-debug-max \
compile-pentium64-max-sci \
compile-pentium64-valgrind-max \
compile-ppc \
compile-ppc-debug \
......
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $fast_cflags -g"
extra_configs="$amd64_configs $max_configs --with-ndb-sci=/opt/DIS"
. "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $fast_cflags -g"
extra_configs="$pentium_configs $max_configs --with-ndb-sci=/opt/DIS"
. "$path/FINISH.sh"
......@@ -22,7 +22,7 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
if test -f "$mysql_sci_dir/lib/libsisci.a" -a \
-f "$mysql_sci_dir/include/sisci_api.h"; then
NDB_SCI_INCLUDES="-I$mysql_sci_dir/include"
NDB_SCI_LIBS="-L$mysql_sci_dir/lib -lsisci"
NDB_SCI_LIBS="$mysql_sci_dir/lib/libsisci.a"
AC_MSG_RESULT([-- including sci transporter])
AC_DEFINE([NDB_SCI_TRANSPORTER], [1],
[Including Ndb Cluster DB sci transporter])
......
......@@ -81,7 +81,7 @@ INC_LIB= $(top_builddir)/regex/libregex.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/vio/libvio.a
$(top_builddir)/vio/libvio.a @NDB_SCI_LIBS@
#
......
......@@ -35,7 +35,8 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \
-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
$(openssl_includes)
LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @innodb_system_libs@ @LIBDL@ $(CXXLDFLAGS)
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @innodb_system_libs@ @LIBDL@ $(CXXLDFLAGS) \
@NDB_SCI_LIBS@
mysqltest_embedded_LINK = $(CXXLINK)
mysqltest_embedded_SOURCES = mysqltest.c
......
-- require r/have_log_bin.require
disable_query_log;
show variables like "log_bin";
enable_query_log;
Variable_name Value
have_log_bin ON
......@@ -79,6 +79,8 @@ typedef ndbd_exit_classification_enum ndbd_exit_classification;
#define NDBD_EXIT_NO_MORE_UNDOLOG 2312
#define NDBD_EXIT_SR_UNDOLOG 2313
#define NDBD_EXIT_SINGLE_USER_MODE 2314
#define NDBD_EXIT_NODE_DECLARED_DEAD 2315
#define NDBD_EXIT_SR_SCHEMAFILE 2316
#define NDBD_EXIT_MEMALLOC 2327
#define NDBD_EXIT_BLOCK_JBUFCONGESTION 2334
#define NDBD_EXIT_TIME_QUEUE_SHORT 2335
......
......@@ -20,7 +20,12 @@
#include <TransporterCallback.hpp>
#include <RefConvert.hpp>
#ifdef ERROR_INSERT
Uint32 MAX_RECEIVED_SIGNALS = 1024;
#else
#define MAX_RECEIVED_SIGNALS 1024
#endif
Uint32
TransporterRegistry::unpack(Uint32 * readPtr,
Uint32 sizeOfData,
......
......@@ -54,12 +54,12 @@
* local segment, the SCI transporter connects to a segment created by another
* transporter at a remote node, and the maps the remote segment into its
* virtual address space. However, since NDB Cluster relies on redundancy
* at the network level, by using dual SCI adapters communica
*
* at the network level, by using dual SCI adapters communication can be
* maintained even if one of the adapter cards fails (or anything on the
* network this adapter card exists in e.g. an SCI switch failure).
*
*/
/**
* class SCITransporter
* @brief - main class for the SCI transporter.
......@@ -84,16 +84,6 @@ public:
sci_error_t createSequence(Uint32 adapterid);
/**
* starts a sequence for error checking.
* The actual checking that a sequence is correct is done implicitly
* in SCIMemCpy (in doSend).
* @param adapterid the adapter on which to start the sequence.
* @return SCI_ERR_OK if ok, otherwize something else.
*/
sci_error_t startSequence(Uint32 adapterid);
/** Initiate Local Segment: create a memory segment,
* prepare a memory segment, map the local segment
* into memory space and make segment available.
......@@ -159,7 +149,6 @@ private:
bool m_mapped;
bool m_initLocal;
bool m_sciinit;
Uint32 m_swapCounter;
Uint32 m_failCounter;
/**
* For statistics on transfered packets
......@@ -195,7 +184,6 @@ private:
*/
Uint32 m_reportFreq;
Uint32 m_adapters;
Uint32 m_numberOfRemoteNodes;
......
......@@ -102,6 +102,10 @@ private:
virtual void updateReceiveDataPtr(Uint32 bytesRead);
virtual Uint32 get_free_buffer() const;
inline bool hasReceiveData () const {
return receiveBuffer.sizeOfData > 0;
}
protected:
/**
* Setup client/server and perform connect/accept
......
......@@ -841,28 +841,13 @@ TransporterRegistry::poll_OSE(Uint32 timeOutMillis)
Uint32
TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
{
bool hasdata = false;
if (false && nTCPTransporters == 0)
{
tcpReadSelectReply = 0;
return 0;
}
struct timeval timeout;
#ifdef NDB_OSE
// Return directly if there are no TCP transporters configured
if(timeOutMillis <= 1){
timeout.tv_sec = 0;
timeout.tv_usec = 1025;
} else {
timeout.tv_sec = timeOutMillis / 1000;
timeout.tv_usec = (timeOutMillis % 1000) * 1000;
}
#else
timeout.tv_sec = timeOutMillis / 1000;
timeout.tv_usec = (timeOutMillis % 1000) * 1000;
#endif
NDB_SOCKET_TYPE maxSocketValue = -1;
// Needed for TCP/IP connections
......@@ -885,8 +870,27 @@ TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
// Put the connected transporters in the socket read-set
FD_SET(socket, &tcpReadset);
}
hasdata |= t->hasReceiveData();
}
timeOutMillis = hasdata ? 0 : timeOutMillis;
struct timeval timeout;
#ifdef NDB_OSE
// Return directly if there are no TCP transporters configured
if(timeOutMillis <= 1){
timeout.tv_sec = 0;
timeout.tv_usec = 1025;
} else {
timeout.tv_sec = timeOutMillis / 1000;
timeout.tv_usec = (timeOutMillis % 1000) * 1000;
}
#else
timeout.tv_sec = timeOutMillis / 1000;
timeout.tv_usec = (timeOutMillis % 1000) * 1000;
#endif
// The highest socket value plus one
maxSocketValue++;
......@@ -901,7 +905,7 @@ TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
}
#endif
return tcpReadSelectReply;
return tcpReadSelectReply || hasdata;
}
#endif
......@@ -937,26 +941,26 @@ TransporterRegistry::performReceive()
#endif
#ifdef NDB_TCP_TRANSPORTER
if(tcpReadSelectReply > 0)
for (int i=0; i<nTCPTransporters; i++)
{
for (int i=0; i<nTCPTransporters; i++)
{
checkJobBuffer();
TCP_Transporter *t = theTCPTransporters[i];
const NodeId nodeId = t->getRemoteNodeId();
const NDB_SOCKET_TYPE socket = t->getSocket();
if(is_connected(nodeId)){
if(t->isConnected() && FD_ISSET(socket, &tcpReadset))
checkJobBuffer();
TCP_Transporter *t = theTCPTransporters[i];
const NodeId nodeId = t->getRemoteNodeId();
const NDB_SOCKET_TYPE socket = t->getSocket();
if(is_connected(nodeId)){
if(t->isConnected())
{
if (FD_ISSET(socket, &tcpReadset))
{
const int receiveSize = t->doReceive();
if(receiveSize > 0)
{
Uint32 * ptr;
Uint32 sz = t->getReceiveData(&ptr);
transporter_recv_from(callbackObj, nodeId);
Uint32 szUsed = unpack(ptr, sz, nodeId, ioStates[nodeId]);
t->updateReceiveDataPtr(szUsed);
}
t->doReceive();
}
if (t->hasReceiveData())
{
Uint32 * ptr;
Uint32 sz = t->getReceiveData(&ptr);
Uint32 szUsed = unpack(ptr, sz, nodeId, ioStates[nodeId]);
t->updateReceiveDataPtr(szUsed);
}
}
}
......
......@@ -132,6 +132,7 @@ Cmvmi::~Cmvmi()
#ifdef ERROR_INSERT
NodeBitmask c_error_9000_nodes_mask;
extern Uint32 MAX_RECEIVED_SIGNALS;
#endif
void Cmvmi::execNDB_TAMPER(Signal* signal)
......@@ -161,6 +162,22 @@ void Cmvmi::execNDB_TAMPER(Signal* signal)
kill(getpid(), SIGABRT);
}
#endif
#ifdef ERROR_INSERT
if (signal->theData[0] == 9003)
{
if (MAX_RECEIVED_SIGNALS < 1024)
{
MAX_RECEIVED_SIGNALS = 1024;
}
else
{
MAX_RECEIVED_SIGNALS = 1 + (rand() % 128);
}
ndbout_c("MAX_RECEIVED_SIGNALS: %d", MAX_RECEIVED_SIGNALS);
CLEAR_ERROR_INSERT_VALUE;
}
#endif
}//execNDB_TAMPER()
void Cmvmi::execSET_LOGLEVELORD(Signal* signal)
......
......@@ -79,6 +79,9 @@
#include <NdbSleep.h>
#include <signaldata/ApiBroadcast.hpp>
#include <EventLogger.hpp>
extern EventLogger g_eventLogger;
#define ZNOT_FOUND 626
#define ZALREADYEXIST 630
......@@ -1069,17 +1072,36 @@ void Dbdict::readSchemaConf(Signal* signal,
for (Uint32 n = 0; n < xsf->noOfPages; n++) {
SchemaFile * sf = &xsf->schemaPage[n];
bool ok =
memcmp(sf->Magic, NDB_SF_MAGIC, sizeof(sf->Magic)) == 0 &&
sf->FileSize != 0 &&
sf->FileSize % NDB_SF_PAGE_SIZE == 0 &&
sf->FileSize == sf0->FileSize &&
sf->PageNumber == n &&
computeChecksum((Uint32*)sf, NDB_SF_PAGE_SIZE_IN_WORDS) == 0;
ndbrequire(ok || !crashInd);
if (! ok) {
bool ok = false;
const char *reason;
if (memcmp(sf->Magic, NDB_SF_MAGIC, sizeof(sf->Magic)) != 0)
{ jam(); reason = "magic code"; }
else if (sf->FileSize == 0)
{ jam(); reason = "file size == 0"; }
else if (sf->FileSize % NDB_SF_PAGE_SIZE != 0)
{ jam(); reason = "invalid size multiple"; }
else if (sf->FileSize != sf0->FileSize)
{ jam(); reason = "invalid size"; }
else if (sf->PageNumber != n)
{ jam(); reason = "invalid page number"; }
else if (computeChecksum((Uint32*)sf, NDB_SF_PAGE_SIZE_IN_WORDS) != 0)
{ jam(); reason = "invalid checksum"; }
else
ok = true;
if (!ok)
{
char reason_msg[128];
snprintf(reason_msg, sizeof(reason_msg),
"schema file corrupt, page %u (%s, "
"sz=%u sz0=%u pn=%u)",
n, reason, sf->FileSize, sf0->FileSize, sf->PageNumber);
if (crashInd)
progError(__LINE__, NDBD_EXIT_SR_SCHEMAFILE, reason_msg);
ndbrequireErr(fsPtr.p->fsState == FsConnectRecord::READ_SCHEMA1,
NDBD_EXIT_SR_SCHEMAFILE);
jam();
ndbrequire(fsPtr.p->fsState == FsConnectRecord::READ_SCHEMA1);
infoEvent("primary %s, trying backup", reason_msg);
readSchemaRef(signal, fsPtr);
return;
}
......
......@@ -2816,7 +2816,7 @@ void Qmgr::failReportLab(Signal* signal, Uint16 aFailedNode,
if (failedNodePtr.i == getOwnNodeId()) {
jam();
Uint32 code = 0;
Uint32 code = NDBD_EXIT_NODE_DECLARED_DEAD;
const char * msg = 0;
char extra[100];
switch(aFailCause){
......
......@@ -57,12 +57,15 @@ static const ErrStruct errArray[] =
"error(s) on other node(s)"},
{NDBD_EXIT_PARTITIONED_SHUTDOWN, XAE, "Partitioned cluster detected. "
"Please check if cluster is already running"},
{NDBD_EXIT_NODE_DECLARED_DEAD, XAE,
"Node declared dead. See error log for details"},
{NDBD_EXIT_POINTER_NOTINRANGE, XIE, "Pointer too large"},
{NDBD_EXIT_SR_OTHERNODEFAILED, XRE, "Another node failed during system "
"restart, please investigate error(s) on other node(s)"},
{NDBD_EXIT_NODE_NOT_DEAD, XRE, "Internal node state conflict, "
"most probably resolved by restarting node again"},
{NDBD_EXIT_SR_REDOLOG, XFI, "Error while reading the REDO log"},
{NDBD_EXIT_SR_SCHEMAFILE, XFI, "Error while reading the schema file"},
/* Currently unused? */
{2311, XIE, "Conflict when selecting restart type"},
{NDBD_EXIT_NO_MORE_UNDOLOG, XCR,
......
......@@ -1306,6 +1306,36 @@ int runTestExecuteAsynch(NDBT_Context* ctx, NDBT_Step* step){
template class Vector<NdbScanOperation*>;
int
runBug28443(NDBT_Context* ctx, NDBT_Step* step)
{
int result = NDBT_OK;
int records = ctx->getNumRecords();
NdbRestarter restarter;
restarter.insertErrorInAllNodes(9003);
for (Uint32 i = 0; i<ctx->getNumLoops(); i++)
{
HugoTransactions hugoTrans(*ctx->getTab());
if (hugoTrans.loadTable(GETNDB(step), records, 2048) != 0)
{
result = NDBT_FAILED;
goto done;
}
if (runClearTable(ctx, step) != 0)
{
result = NDBT_FAILED;
goto done;
}
}
done:
restarter.insertErrorInAllNodes(9003);
return result;
}
NDBT_TESTSUITE(testNdbApi);
TESTCASE("MaxNdb",
......@@ -1396,6 +1426,10 @@ TESTCASE("ExecuteAsynch",
"Check that executeAsync() works (BUG#27495)\n"){
INITIALIZER(runTestExecuteAsynch);
}
TESTCASE("Bug28443",
""){
INITIALIZER(runBug28443);
}
NDBT_TESTSUITE_END(testNdbApi);
int main(int argc, const char** argv){
......
......@@ -629,6 +629,10 @@ max-time: 500
cmd: testNdbApi
args: -n ExecuteAsynch T1
max-time: 1000
cmd: testNdbApi
args: -n BugBug28443
#max-time: 500
#cmd: testInterpreter
#args: T1
......
......@@ -2309,16 +2309,24 @@ int ha_ndbcluster::write_row(byte *record)
{
// Table has hidden primary key
Ndb *ndb= get_ndb();
int ret;
Uint64 auto_value;
uint retries= NDB_AUTO_INCREMENT_RETRIES;
do {
ret= ndb->getAutoIncrementValue((const NDBTAB *) m_table, auto_value, 1);
} while (ret == -1 &&
--retries &&
ndb->getNdbError().status == NdbError::TemporaryError);
if (ret == -1)
ERR_RETURN(ndb->getNdbError());
int retry_sleep= 30; /* 30 milliseconds, transaction */
for (;;)
{
if (ndb->getAutoIncrementValue((const NDBTAB *) m_table,
auto_value, 1) == -1)
{
if (--retries &&
ndb->getNdbError().status == NdbError::TemporaryError);
{
my_sleep(retry_sleep);
continue;
}
ERR_RETURN(ndb->getNdbError());
}
break;
}
if (set_hidden_key(op, table->s->fields, (const byte*)&auto_value))
ERR_RETURN(op->getNdbError());
}
......@@ -4855,22 +4863,27 @@ ulonglong ha_ndbcluster::get_auto_increment()
m_rows_to_insert - m_rows_inserted :
((m_rows_to_insert > m_autoincrement_prefetch) ?
m_rows_to_insert : m_autoincrement_prefetch));
int ret;
uint retries= NDB_AUTO_INCREMENT_RETRIES;
do {
ret=
m_skip_auto_increment ?
ndb->readAutoIncrementValue((const NDBTAB *) m_table, auto_value) :
ndb->getAutoIncrementValue((const NDBTAB *) m_table, auto_value, cache_size);
} while (ret == -1 &&
--retries &&
ndb->getNdbError().status == NdbError::TemporaryError);
if (ret == -1)
{
const NdbError err= ndb->getNdbError();
sql_print_error("Error %lu in ::get_auto_increment(): %s",
(ulong) err.code, err.message);
DBUG_RETURN(~(ulonglong) 0);
int retry_sleep= 30; /* 30 milliseconds, transaction */
for (;;)
{
if (m_skip_auto_increment &&
ndb->readAutoIncrementValue((const NDBTAB *) m_table, auto_value) ||
ndb->getAutoIncrementValue((const NDBTAB *) m_table,
auto_value, cache_size))
{
if (--retries &&
ndb->getNdbError().status == NdbError::TemporaryError);
{
my_sleep(retry_sleep);
continue;
}
const NdbError err= ndb->getNdbError();
sql_print_error("Error %lu in ::get_auto_increment(): %s",
(ulong) err.code, err.message);
DBUG_RETURN(~(ulonglong) 0);
}
break;
}
DBUG_RETURN((longlong)auto_value);
}
......@@ -5011,27 +5024,36 @@ int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked)
set_dbname(name);
set_tabname(name);
if (check_ndb_connection()) {
free_share(m_share); m_share= 0;
DBUG_RETURN(HA_ERR_NO_CONNECTION);
if ((res= check_ndb_connection()) ||
(res= get_metadata(name)))
{
free_share(m_share);
m_share= 0;
DBUG_RETURN(res);
}
res= get_metadata(name);
if (!res)
while (1)
{
Ndb *ndb= get_ndb();
if (ndb->setDatabaseName(m_dbname))
{
ERR_RETURN(ndb->getNdbError());
res= ndb_to_mysql_error(&ndb->getNdbError());
break;
}
struct Ndb_statistics stat;
res= ndb_get_table_statistics(NULL, false, ndb, m_tabname, &stat);
records= stat.row_count;
if(!res)
res= info(HA_STATUS_CONST);
break;
}
DBUG_RETURN(res);
if (res)
{
free_share(m_share);
m_share= 0;
release_metadata();
DBUG_RETURN(res);
}
DBUG_RETURN(0);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment