Commit 1e84c799 authored by ngrishakin@ndb15.mysql.com's avatar ngrishakin@ndb15.mysql.com

Merge ngrishakin@bk-internal.mysql.com:/home/bk/mysql-5.1

into  mysql.com:/home/ndbdev/ngrishakin/mysql-5.1
parents f72ec8a5 25ea9964
......@@ -18,10 +18,7 @@
#im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_autodiscover3 : BUD#20843 2006-07-04 tomas ndb_autodiscover3 fails randomly
#ndb_binlog_discover : BUG#19395 2006-04-28 tomas/knielsen mysqld does not always detect cluster shutdown
#ndb_cache2 : BUG#18597 2006-03-28 brian simultaneous drop table and ndb statistics update triggers node failure
#ndb_cache_multi2 : BUG#18597 2006-04-10 kent simultaneous drop table and ndb statistics update triggers node failure
ndb_autodiscover3 : BUG#20872 2006-07-05 tomas ndb_autodiscover3 fails randomly
ndb_load : BUG#17233 2006-05-04 tomas failed load data from infile causes mysqld dbug_assert, binlog not flushed
partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table
ps_7ndb : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open
......
......@@ -181,11 +181,21 @@ if [ $BASE_SYSTEM = "netware" ] ; then
fi
copyfileto $BASE/lib \
libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* \
libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a \
libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* \
libmysql/.libs/libmysqlclient.a \
libmysql/.libs/libmysqlclient.so* \
libmysql/.libs/libmysqlclient.sl* \
libmysql/.libs/libmysqlclient*.dylib \
libmysql/libmysqlclient.* \
libmysql_r/.libs/libmysqlclient_r.a \
libmysql_r/.libs/libmysqlclient_r.so* \
libmysql_r/.libs/libmysqlclient_r.sl* \
libmysql_r/.libs/libmysqlclient_r*.dylib \
libmysql_r/libmysqlclient_r.* \
libmysqld/.libs/libmysqld.a \
libmysqld/.libs/libmysqld.so* \
libmysqld/.libs/libmysqld.sl* \
libmysqld/.libs/libmysqld*.dylib \
mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a \
libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* \
libmysqld/libmysqld.a netware/libmysql.imp \
zlib/.libs/libz.a
......
......@@ -3442,8 +3442,8 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
// wait for the first event
thd->proc_info= "Waiting for first event from ndbcluster";
DBUG_PRINT("info", ("Waiting for the first event"));
int schema_res= 0;
Uint64 schema_gci= 0;
int schema_res= 0, res= 0;
Uint64 schema_gci= 0, gci= 0;
while (schema_res == 0 && !abort_loop)
{
schema_res= s_ndb->pollEvents(100, &schema_gci);
......@@ -3452,7 +3452,14 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
DBUG_PRINT("info", ("schema_res: %d schema_gci: %d", schema_res, schema_gci));
if (schema_res > 0)
{
i_ndb->pollEvents(0);
while (res >= 0 && gci < schema_gci && !abort_loop)
{
res= i_ndb->pollEvents(100, &gci);
}
if (gci > schema_gci)
{
schema_gci= gci;
}
i_ndb->flushIncompleteEvents(schema_gci);
s_ndb->flushIncompleteEvents(schema_gci);
if (schema_gci < ndb_latest_handled_binlog_epoch)
......@@ -3466,6 +3473,17 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
ndb_latest_applied_binlog_epoch= 0;
ndb_latest_received_binlog_epoch= 0;
}
else if (ndb_latest_applied_binlog_epoch > 0)
{
sql_print_warning("NDB Binlog: cluster has reconnected. "
"Changes to the database that occured while "
"disconnected will not be in the binlog");
}
if (ndb_extra_logging)
{
sql_print_information("NDB Binlog: starting log at epoch %u",
(unsigned)schema_gci);
}
}
}
{
......
......@@ -71,6 +71,7 @@ typedef ndbd_exit_classification_enum ndbd_exit_classification;
#define NDBD_EXIT_INDEX_NOTINRANGE 2304
#define NDBD_EXIT_ARBIT_SHUTDOWN 2305
#define NDBD_EXIT_POINTER_NOTINRANGE 2306
#define NDBD_EXIT_PARTITIONED_SHUTDOWN 2307
#define NDBD_EXIT_SR_OTHERNODEFAILED 2308
#define NDBD_EXIT_NODE_NOT_DEAD 2309
#define NDBD_EXIT_SR_REDOLOG 2310
......
......@@ -438,6 +438,7 @@ void Qmgr::execCONNECT_REP(Signal* signal)
void
Qmgr::execREAD_NODESCONF(Signal* signal)
{
jamEntry();
check_readnodes_reply(signal,
refToNode(signal->getSendersBlockRef()),
GSN_READ_NODESCONF);
......@@ -446,6 +447,7 @@ Qmgr::execREAD_NODESCONF(Signal* signal)
void
Qmgr::execREAD_NODESREF(Signal* signal)
{
jamEntry();
check_readnodes_reply(signal,
refToNode(signal->getSendersBlockRef()),
GSN_READ_NODESREF);
......@@ -907,9 +909,9 @@ Qmgr::check_readnodes_reply(Signal* signal, Uint32 nodeId, Uint32 gsn)
char buf[255];
BaseString::snprintf(buf, sizeof(buf),
"Partitioned cluster! check StartPartialTimeout, "
" node %d thinks %d is president, "
" I think president is: %d",
"check StartPartialTimeout, "
"node %d thinks %d is president, "
"I think president is: %d",
nodeId, president, cpresident);
ndbout_c(buf);
......@@ -941,7 +943,7 @@ Qmgr::check_readnodes_reply(Signal* signal, Uint32 nodeId, Uint32 gsn)
CRASH_INSERTION(932);
progError(__LINE__,
NDBD_EXIT_ARBIT_SHUTDOWN,
NDBD_EXIT_PARTITIONED_SHUTDOWN,
buf);
ndbrequire(false);
......@@ -2798,7 +2800,7 @@ void Qmgr::failReportLab(Signal* signal, Uint16 aFailedNode,
break;
case FailRep::ZPARTITIONED_CLUSTER:
{
code = NDBD_EXIT_ARBIT_SHUTDOWN;
code = NDBD_EXIT_PARTITIONED_SHUTDOWN;
char buf1[100], buf2[100];
c_clusterNodes.getText(buf1);
if (signal->getLength()== FailRep::SignalLength + FailRep::ExtraLength &&
......@@ -2809,16 +2811,14 @@ void Qmgr::failReportLab(Signal* signal, Uint16 aFailedNode,
part.assign(NdbNodeBitmask::Size, rep->partition);
part.getText(buf2);
BaseString::snprintf(extra, sizeof(extra),
"Partitioned cluster!"
" Our cluster: %s other cluster: %s",
"Our cluster: %s other cluster: %s",
buf1, buf2);
}
else
{
jam();
BaseString::snprintf(extra, sizeof(extra),
"Partitioned cluster!"
" Our cluster: %s ", buf1);
"Our cluster: %s", buf1);
}
msg = extra;
break;
......
......@@ -54,6 +54,8 @@ static const ErrStruct errArray[] =
{NDBD_EXIT_ARBIT_SHUTDOWN, XAE, "Node lost connection to other nodes and "
"can not form a unpartitioned cluster, please investigate if there are "
"error(s) on other node(s)"},
{NDBD_EXIT_PARTITIONED_SHUTDOWN, XAE, "Partitioned cluster detected. "
"Please check if cluster is already running"},
{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)"},
......
......@@ -312,6 +312,8 @@ GlobalDictCache::invalidate_all()
if (vers->size())
{
TableVersion * ver = & vers->back();
if (ver->m_status != RETREIVING)
{
ver->m_impl->m_status = NdbDictionary::Object::Invalid;
ver->m_status = DROPPED;
if (ver->m_refCount == 0)
......@@ -320,6 +322,7 @@ GlobalDictCache::invalidate_all()
vers->erase(vers->size() - 1);
}
}
}
curr = m_tableHash.getNext(curr);
}
DBUG_VOID_RETURN;
......
......@@ -1025,14 +1025,19 @@ int Ndb::initAutoIncrement()
setDatabaseName("sys");
setDatabaseSchemaName("def");
m_sys_tab_0 = getDictionary()->getTableGlobal("SYSTAB_0");
m_sys_tab_0 = theDictionary->getTableGlobal("SYSTAB_0");
// Restore current name space
setDatabaseName(currentDb.c_str());
setDatabaseSchemaName(currentSchema.c_str());
if (m_sys_tab_0 == NULL) {
assert(theDictionary->m_error.code != 0);
theError.code = theDictionary->m_error.code;
return -1;
}
return (m_sys_tab_0 == NULL);
return 0;
}
int
......@@ -1043,19 +1048,19 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table,
Uint32 aTableId = table->m_id;
DBUG_PRINT("enter", ("table=%u value=%llu op=%u", aTableId, opValue, op));
NdbTransaction* tConnection;
NdbOperation* tOperation= 0; // Compiler warning if not initialized
NdbTransaction* tConnection = NULL;
NdbOperation* tOperation = NULL;
Uint64 tValue;
NdbRecAttr* tRecAttrResult;
CHECK_STATUS_MACRO_ZERO;
CHECK_STATUS_MACRO;
if (initAutoIncrement())
goto error_return;
if (initAutoIncrement() == -1)
goto error_handler;
tConnection = this->startTransaction();
if (tConnection == NULL)
goto error_return;
goto error_handler;
tOperation = tConnection->getNdbOperation(m_sys_tab_0);
if (tOperation == NULL)
......@@ -1065,7 +1070,7 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table,
{
case 0:
tOperation->interpretedUpdateTuple();
tOperation->equal("SYSKEY_0", aTableId );
tOperation->equal("SYSKEY_0", aTableId);
tOperation->incValue("NEXTID", opValue);
tRecAttrResult = tOperation->getValue("NEXTID");
......@@ -1130,14 +1135,21 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table,
DBUG_RETURN(0);
error_handler:
theError.code = tConnection->theError.code;
this->closeTransaction(tConnection);
error_return:
error_handler:
DBUG_PRINT("error", ("ndb=%d con=%d op=%d",
theError.code,
tConnection ? tConnection->theError.code : -1,
tOperation ? tOperation->theError.code : -1));
tConnection != NULL ? tConnection->theError.code : -1,
tOperation != NULL ? tOperation->theError.code : -1));
if (theError.code == 0 && tConnection != NULL)
theError.code = tConnection->theError.code;
if (theError.code == 0 && tOperation != NULL)
theError.code = tOperation->theError.code;
DBUG_ASSERT(theError.code != 0);
if (tConnection != NULL)
this->closeTransaction(tConnection);
DBUG_RETURN(-1);
}
......
......@@ -942,6 +942,7 @@ NdbEventBuffer::NdbEventBuffer(Ndb *ndb) :
{
#ifdef VM_TRACE
m_latest_command= "NdbEventBuffer::NdbEventBuffer";
m_flush_gci = 0;
#endif
if ((p_cond = NdbCondition_Create()) == NULL) {
......@@ -1109,6 +1110,8 @@ NdbEventBuffer::flushIncompleteEvents(Uint64 gci)
/**
* Find min complete gci
*/
// called by user thread, so we need to lock the data
lock();
Uint32 i;
Uint32 sz= m_active_gci.size();
Gci_container* array = (Gci_container*)m_active_gci.getBase();
......@@ -1127,6 +1130,10 @@ NdbEventBuffer::flushIncompleteEvents(Uint64 gci)
bzero(tmp, sizeof(Gci_container));
}
}
#ifdef VM_TRACE
m_flush_gci = gci;
#endif
unlock();
return 0;
}
......@@ -1301,7 +1308,11 @@ operator<<(NdbOut& out, const Gci_container_pod& gci)
static
Gci_container*
find_bucket_chained(Vector<Gci_container_pod> * active, Uint64 gci)
find_bucket_chained(Vector<Gci_container_pod> * active, Uint64 gci
#ifdef VM_TRACE
,Uint64 flush_gci
#endif
)
{
Uint32 pos = (gci & ACTIVE_GCI_MASK);
Gci_container *bucket= ((Gci_container*)active->getBase()) + pos;
......@@ -1322,6 +1333,13 @@ find_bucket_chained(Vector<Gci_container_pod> * active, Uint64 gci)
bzero(bucket, sizeof(Gci_container));
bucket->m_gci = gci;
bucket->m_gcp_complete_rep_count = ~(Uint32)0;
#ifdef VM_TRACE
if (gci < flush_gci)
{
ndbout_c("received old gci %llu < flush gci %llu", gci, flush_gci);
assert(false);
}
#endif
return bucket;
}
move_pos += ACTIVE_GCI_DIRECTORY_SIZE;
......@@ -1336,7 +1354,16 @@ find_bucket_chained(Vector<Gci_container_pod> * active, Uint64 gci)
bucket += ACTIVE_GCI_DIRECTORY_SIZE;
if(bucket->m_gci == gci)
{
#ifdef VM_TRACE
if (gci < flush_gci)
{
ndbout_c("received old gci %llu < flush gci %llu", gci, flush_gci);
assert(false);
}
#endif
return bucket;
}
} while(pos < size);
......@@ -1346,14 +1373,22 @@ find_bucket_chained(Vector<Gci_container_pod> * active, Uint64 gci)
inline
Gci_container*
find_bucket(Vector<Gci_container_pod> * active, Uint64 gci)
find_bucket(Vector<Gci_container_pod> * active, Uint64 gci
#ifdef VM_TRACE
,Uint64 flush_gci
#endif
)
{
Uint32 pos = (gci & ACTIVE_GCI_MASK);
Gci_container *bucket= ((Gci_container*)active->getBase()) + pos;
if(likely(gci == bucket->m_gci))
return bucket;
return find_bucket_chained(active,gci);
return find_bucket_chained(active,gci
#ifdef VM_TRACE
, flush_gci
#endif
);
}
static
......@@ -1386,7 +1421,11 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep)
const Uint64 gci= rep->gci;
const Uint32 cnt= rep->gcp_complete_rep_count;
Gci_container *bucket = find_bucket(&m_active_gci, gci);
Gci_container *bucket = find_bucket(&m_active_gci, gci
#ifdef VM_TRACE
, m_flush_gci
#endif
);
if (unlikely(bucket == 0))
{
......@@ -1752,7 +1791,11 @@ NdbEventBuffer::insertDataL(NdbEventOperationImpl *op,
if ( likely((Uint32)op->mi_type & (1 << (Uint32)sdata->operation)) )
{
Gci_container* bucket= find_bucket(&m_active_gci, gci);
Gci_container* bucket= find_bucket(&m_active_gci, gci
#ifdef VM_TRACE
, m_flush_gci
#endif
);
DBUG_PRINT_EVENT("info", ("data insertion in eventId %d", op->m_eventId));
DBUG_PRINT_EVENT("info", ("gci=%d tab=%d op=%d node=%d",
......
......@@ -463,6 +463,7 @@ public:
#ifdef VM_TRACE
const char *m_latest_command;
Uint64 m_flush_gci;
#endif
Ndb *m_ndb;
......
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