From 8ee6d33bdd49978b68a78126653d3b4aaa60a4ca Mon Sep 17 00:00:00 2001 From: "dlenev@brandersnatch.localdomain" <> Date: Sat, 30 Apr 2005 20:23:40 +0400 Subject: [PATCH 01/58] Fix for Bug #9913 "udf_deinit is not called after execution of PS" (aka "deinit is not called when calling udf from trigger"). We should call udf_deinit() function during cleanup phase after prepared (or ordinary) statement execution instead of calling it from Item's desctructor. No test case is provided since it is hard to test UDF's from our test suite. --- sql/item_func.cc | 15 +++++++++++++++ sql/item_func.h | 1 + sql/item_sum.cc | 11 +++++++++++ sql/item_sum.h | 1 + sql/sql_udf.h | 1 + 5 files changed, 29 insertions(+) diff --git a/sql/item_func.cc b/sql/item_func.cc index 2b38584fe23..d1d89b70d10 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1617,6 +1617,13 @@ longlong Item_func_bit_count::val_int() #ifdef HAVE_DLOPEN udf_handler::~udf_handler() +{ + /* Everything should be properly cleaned up by this moment. */ + DBUG_ASSERT(not_original || !(initialized || buffers)); +} + + +void udf_handler::cleanup() { if (!not_original) { @@ -1629,9 +1636,11 @@ udf_handler::~udf_handler() (*deinit)(&initid); } free_udf(u_d); + initialized= FALSE; } if (buffers) // Because of bug in ecc delete [] buffers; + buffers= 0; } } @@ -1871,6 +1880,12 @@ String *udf_handler::val_str(String *str,String *save_str) } +void Item_udf_func::cleanup() +{ + udf.cleanup(); + Item_func::cleanup(); +} + double Item_func_udf_float::val() { diff --git a/sql/item_func.h b/sql/item_func.h index 3a309f4ae99..7244fc73a42 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -786,6 +786,7 @@ public: fixed= 1; return res; } + void cleanup(); Item_result result_type () const { return udf.result_type(); } table_map not_null_tables() const { return 0; } }; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 7e9c5d09136..dd4cda4ff91 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1449,6 +1449,17 @@ bool Item_udf_sum::add() DBUG_RETURN(0); } +void Item_udf_sum::cleanup() +{ + /* + udf_handler::cleanup() nicely handles case when we have not + original item but one created by copy_or_same() method. + */ + udf.cleanup(); + Item_sum::cleanup(); +} + + Item *Item_sum_udf_float::copy_or_same(THD* thd) { return new (thd->mem_root) Item_sum_udf_float(thd, this); diff --git a/sql/item_sum.h b/sql/item_sum.h index dab136e4716..040d9395e3a 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -550,6 +550,7 @@ public: bool add(); void reset_field() {}; void update_field() {}; + void cleanup(); }; diff --git a/sql/sql_udf.h b/sql/sql_udf.h index d1f99a6d232..acb04e949a3 100644 --- a/sql/sql_udf.h +++ b/sql/sql_udf.h @@ -67,6 +67,7 @@ class udf_handler :public Sql_alloc bool get_arguments(); bool fix_fields(THD *thd,struct st_table_list *tlist,Item_result_field *item, uint arg_count,Item **args); + void cleanup(); double val(my_bool *null_value) { if (get_arguments()) From 7ebc32ee8b2a1fb123bc929b46ff8157be18bafd Mon Sep 17 00:00:00 2001 From: "joreland@mysql.com" <> Date: Tue, 3 May 2005 12:16:31 +0200 Subject: [PATCH 02/58] bug#10142 - ndb unhandle resource shortage in unique index code --- ndb/src/kernel/blocks/dbtc/Dbtc.hpp | 30 +-------- ndb/src/kernel/blocks/dbtc/DbtcInit.cpp | 4 +- ndb/src/kernel/blocks/dbtc/DbtcMain.cpp | 81 ++++++++++++------------- ndb/src/kernel/error/ErrorReporter.cpp | 5 +- ndb/src/ndbapi/NdbIndexOperation.cpp | 2 +- ndb/src/ndbapi/ndberror.c | 2 +- 6 files changed, 47 insertions(+), 77 deletions(-) diff --git a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp index fb90ccc8c90..fbd181cae24 100644 --- a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp +++ b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp @@ -585,34 +585,8 @@ public: */ ArrayPool c_theIndexOperationPool; - /** - * The list of index operations - */ - ArrayList c_theIndexOperations; - UintR c_maxNumberOfIndexOperations; - struct TcSeizedIndexOperation { - /** - * Next ptr (used in pool/list) - */ - union { - Uint32 nextPool; - Uint32 nextList; - }; - /** - * Prev pointer (used in list) - */ - Uint32 prevList; - }; - - /** - * Pool of seized index operations - */ - ArrayPool c_theSeizedIndexOperationPool; - - typedef Ptr TcSeizedIndexOperationPtr; - /************************** API CONNECT RECORD *********************** * The API connect record contains the connection record to which the * application connects. @@ -650,7 +624,7 @@ public: struct ApiConnectRecord { ApiConnectRecord(ArrayPool & firedTriggerPool, - ArrayPool & seizedIndexOpPool): + ArrayPool & seizedIndexOpPool): theFiredTriggers(firedTriggerPool), isIndexOp(false), theSeizedIndexOperations(seizedIndexOpPool) @@ -763,7 +737,7 @@ public: UintR accumulatingIndexOp; UintR executingIndexOp; UintR tcIndxSendArray[6]; - ArrayList theSeizedIndexOperations; + ArrayList theSeizedIndexOperations; }; typedef Ptr ApiConnectRecordPtr; diff --git a/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp b/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp index 59c8237f20a..f99b4bf15af 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp @@ -65,7 +65,6 @@ void Dbtc::initData() c_theFiredTriggerPool.setSize(c_maxNumberOfFiredTriggers); c_theIndexPool.setSize(c_maxNumberOfIndexes); c_theIndexOperationPool.setSize(c_maxNumberOfIndexOperations); - c_theSeizedIndexOperationPool.setSize(c_maxNumberOfIndexOperations); c_theAttributeBufferPool.setSize(c_transactionBufferSpace); c_firedTriggerHash.setSize((c_maxNumberOfFiredTriggers+10)/10); }//Dbtc::initData() @@ -85,7 +84,7 @@ void Dbtc::initRecords() for(unsigned i = 0; i triggers(c_theFiredTriggerPool); @@ -177,7 +176,6 @@ Dbtc::Dbtc(const class Configuration & conf): c_maxNumberOfFiredTriggers(0), c_theIndexes(c_theIndexPool), c_maxNumberOfIndexes(0), - c_theIndexOperations(c_theIndexOperationPool), c_maxNumberOfIndexOperations(0), m_commitAckMarkerHash(m_commitAckMarkerPool) { diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index efd4c2a46d0..c1ce1613b35 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -11161,16 +11161,21 @@ void Dbtc::execTCINDXREQ(Signal* signal) jam(); // This is a newly started transaction, clean-up releaseAllSeizedIndexOperations(regApiPtr); + + regApiPtr->transid[0] = tcIndxReq->transId1; + regApiPtr->transid[1] = tcIndxReq->transId2; }//if - if (!seizeIndexOperation(regApiPtr, indexOpPtr)) { + ndbout_c("here"); + + if (ERROR_INSERTED(8036) || !seizeIndexOperation(regApiPtr, indexOpPtr)) { jam(); // Failed to allocate index operation TcIndxRef * const tcIndxRef = (TcIndxRef *)signal->getDataPtrSend(); - + tcIndxRef->connectPtr = tcIndxReq->senderData; tcIndxRef->transId[0] = regApiPtr->transid[0]; tcIndxRef->transId[1] = regApiPtr->transid[1]; - tcIndxRef->errorCode = 4000; + tcIndxRef->errorCode = 288; sendSignal(regApiPtr->ndbapiBlockref, GSN_TCINDXREF, signal, TcIndxRef::SignalLength, JBB); return; @@ -11307,15 +11312,17 @@ void Dbtc::execINDXKEYINFO(Signal* signal) TcIndexOperationPtr indexOpPtr; TcIndexOperation* indexOp; - indexOpPtr.i = regApiPtr->accumulatingIndexOp; - indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); - if (saveINDXKEYINFO(signal, - indexOp, - src, - keyInfoLength)) { - jam(); - // We have received all we need - readIndexTable(signal, regApiPtr, indexOp); + if((indexOpPtr.i = regApiPtr->accumulatingIndexOp) != RNIL) + { + indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i); + if (saveINDXKEYINFO(signal, + indexOp, + src, + keyInfoLength)) { + jam(); + // We have received all we need + readIndexTable(signal, regApiPtr, indexOp); + } } } @@ -11338,15 +11345,17 @@ void Dbtc::execINDXATTRINFO(Signal* signal) TcIndexOperationPtr indexOpPtr; TcIndexOperation* indexOp; - indexOpPtr.i = regApiPtr->accumulatingIndexOp; - indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); - if (saveINDXATTRINFO(signal, - indexOp, - src, - attrInfoLength)) { - jam(); - // We have received all we need - readIndexTable(signal, regApiPtr, indexOp); + if((indexOpPtr.i = regApiPtr->accumulatingIndexOp) != RNIL) + { + indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i); + if (saveINDXATTRINFO(signal, + indexOp, + src, + attrInfoLength)) { + jam(); + // We have received all we need + readIndexTable(signal, regApiPtr, indexOp); + } } } @@ -11371,7 +11380,7 @@ bool Dbtc::saveINDXKEYINFO(Signal* signal, releaseIndexOperation(apiConnectptr.p, indexOp); terrorCode = 4000; abortErrorLab(signal); - return true; + return false; } if (receivedAllINDXKEYINFO(indexOp) && receivedAllINDXATTRINFO(indexOp)) { jam(); @@ -11404,7 +11413,7 @@ bool Dbtc::saveINDXATTRINFO(Signal* signal, releaseIndexOperation(apiConnectptr.p, indexOp); terrorCode = 4000; abortErrorLab(signal); - return true; + return false; } if (receivedAllINDXKEYINFO(indexOp) && receivedAllINDXATTRINFO(indexOp)) { jam(); @@ -11464,7 +11473,7 @@ void Dbtc::execTCKEYCONF(Signal* signal) jamEntry(); indexOpPtr.i = tcKeyConf->apiConnectPtr; - TcIndexOperation* indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); + TcIndexOperation* indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i); Uint32 confInfo = tcKeyConf->confInfo; /** @@ -11553,7 +11562,7 @@ void Dbtc::execTCKEYREF(Signal* signal) jamEntry(); indexOpPtr.i = tcKeyRef->connectPtr; - TcIndexOperation* indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); + TcIndexOperation* indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i); indexOpPtr.p = indexOp; if (!indexOp) { jam(); @@ -11654,7 +11663,7 @@ void Dbtc::execTRANSID_AI(Signal* signal) jamEntry(); TcIndexOperationPtr indexOpPtr; indexOpPtr.i = transIdAI->connectPtr; - TcIndexOperation* indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); + TcIndexOperation* indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i); indexOpPtr.p = indexOp; if (!indexOp) { jam(); @@ -11762,7 +11771,7 @@ void Dbtc::execTCROLLBACKREP(Signal* signal) jamEntry(); TcIndexOperationPtr indexOpPtr; indexOpPtr.i = tcRollbackRep->connectPtr; - TcIndexOperation* indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); + TcIndexOperation* indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i); indexOpPtr.p = indexOp; tcRollbackRep = (TcRollbackRep *)signal->getDataPtrSend(); tcRollbackRep->connectPtr = indexOp->tcIndxReq.senderData; @@ -12090,16 +12099,7 @@ void Dbtc::executeIndexOperation(Signal* signal, bool Dbtc::seizeIndexOperation(ApiConnectRecord* regApiPtr, TcIndexOperationPtr& indexOpPtr) { - bool seizeOk; - - seizeOk = c_theIndexOperations.seize(indexOpPtr); - if (seizeOk) { - jam(); - TcSeizedIndexOperationPtr seizedIndexOpPtr; - seizeOk &= regApiPtr->theSeizedIndexOperations.seizeId(seizedIndexOpPtr, - indexOpPtr.i); - } - return seizeOk; + return regApiPtr->theSeizedIndexOperations.seize(indexOpPtr); } void Dbtc::releaseIndexOperation(ApiConnectRecord* regApiPtr, @@ -12113,18 +12113,16 @@ void Dbtc::releaseIndexOperation(ApiConnectRecord* regApiPtr, indexOp->expectedTransIdAI = 0; indexOp->transIdAI.release(); regApiPtr->theSeizedIndexOperations.release(indexOp->indexOpId); - c_theIndexOperations.release(indexOp->indexOpId); } void Dbtc::releaseAllSeizedIndexOperations(ApiConnectRecord* regApiPtr) { - TcSeizedIndexOperationPtr seizedIndexOpPtr; + TcIndexOperationPtr seizedIndexOpPtr; regApiPtr->theSeizedIndexOperations.first(seizedIndexOpPtr); while(seizedIndexOpPtr.i != RNIL) { jam(); - TcIndexOperation* indexOp = - c_theIndexOperations.getPtr(seizedIndexOpPtr.i); + TcIndexOperation* indexOp = seizedIndexOpPtr.p; indexOp->indexOpState = IOS_NOOP; indexOp->expectedKeyInfo = 0; @@ -12133,7 +12131,6 @@ void Dbtc::releaseAllSeizedIndexOperations(ApiConnectRecord* regApiPtr) indexOp->attrInfo.release(); indexOp->expectedTransIdAI = 0; indexOp->transIdAI.release(); - c_theIndexOperations.release(seizedIndexOpPtr.i); regApiPtr->theSeizedIndexOperations.next(seizedIndexOpPtr); } regApiPtr->theSeizedIndexOperations.release(); diff --git a/ndb/src/kernel/error/ErrorReporter.cpp b/ndb/src/kernel/error/ErrorReporter.cpp index 35cd3f099d9..38088fe8f3e 100644 --- a/ndb/src/kernel/error/ErrorReporter.cpp +++ b/ndb/src/kernel/error/ErrorReporter.cpp @@ -130,7 +130,7 @@ ErrorReporter::formatMessage(ErrorCategory type, "Date/Time: %s\nType of error: %s\n" "Message: %s\nFault ID: %d\nProblem data: %s" "\nObject of reference: %s\nProgramName: %s\n" - "ProcessID: %d\nTraceFile: %s\n***EOM***\n", + "ProcessID: %d\nTraceFile: %s\n%s\n***EOM***\n", formatTimeStampString() , errorType[type], lookupErrorMessage(faultID), @@ -139,7 +139,8 @@ ErrorReporter::formatMessage(ErrorCategory type, objRef, my_progname, processId, - theNameOfTheTraceFile ? theNameOfTheTraceFile : ""); + theNameOfTheTraceFile ? theNameOfTheTraceFile : "", + NDB_VERSION_STRING); // Add trailing blanks to get a fixed lenght of the message while (strlen(messptr) <= MESSAGE_LENGTH-3){ diff --git a/ndb/src/ndbapi/NdbIndexOperation.cpp b/ndb/src/ndbapi/NdbIndexOperation.cpp index 39da9c5f5d0..c24e7db5942 100644 --- a/ndb/src/ndbapi/NdbIndexOperation.cpp +++ b/ndb/src/ndbapi/NdbIndexOperation.cpp @@ -752,5 +752,5 @@ NdbIndexOperation::receiveTCINDXREF( NdbApiSignal* aSignal) Uint32 errorCode = tcIndxRef->errorCode; theError.code = errorCode; theNdbCon->setOperationErrorCodeAbort(errorCode); - return theNdbCon->OpCompleteFailure(theNdbCon->m_abortOption); + return theNdbCon->OpCompleteFailure(AbortOnError); }//NdbIndexOperation::receiveTCINDXREF() diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c index bbc82a21324..71b0ed6a82f 100644 --- a/ndb/src/ndbapi/ndberror.c +++ b/ndb/src/ndbapi/ndberror.c @@ -169,7 +169,7 @@ ErrorBundle ErrorCodes[] = { { 4021, TR, "Out of Send Buffer space in NDB API" }, { 4022, TR, "Out of Send Buffer space in NDB API" }, { 4032, TR, "Out of Send Buffer space in NDB API" }, - + { 288, TR, "Out of index operations in transaction coordinator (increase MaxNoOfConcurrentIndexOperations)" }, /** * InsufficientSpace */ From 5b5565c30a8678ab69b1089aef3c05c8bba29d08 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 4 May 2005 15:05:56 +0200 Subject: [PATCH 03/58] BUG#10241 cygwin port: invalid pragma interface directives - Introduce ifdefs so we can control when to use #pragma interface on cygwin --- include/my_global.h | 5 +++++ include/raid.h | 2 +- sql/examples/ha_archive.h | 2 +- sql/examples/ha_example.h | 2 +- sql/field.h | 2 +- sql/ha_berkeley.h | 2 +- sql/ha_blackhole.h | 2 +- sql/ha_heap.h | 2 +- sql/ha_innodb.h | 2 +- sql/ha_isam.h | 2 +- sql/ha_isammrg.h | 2 +- sql/ha_myisam.h | 2 +- sql/ha_myisammrg.h | 2 +- sql/ha_ndbcluster.h | 2 +- sql/handler.h | 2 +- sql/item.h | 2 +- sql/item_cmpfunc.h | 2 +- sql/item_func.h | 2 +- sql/item_geofunc.h | 2 +- sql/item_strfunc.h | 3 ++- sql/item_subselect.h | 2 +- sql/item_sum.h | 2 +- sql/item_timefunc.h | 2 +- sql/opt_range.h | 2 +- sql/procedure.h | 2 +- sql/protocol.h | 2 +- sql/set_var.h | 2 +- sql/sql_class.h | 2 +- sql/sql_list.h | 2 +- sql/sql_select.h | 2 +- sql/sql_string.h | 2 +- sql/sql_udf.h | 2 +- sql/tztime.h | 2 +- 33 files changed, 38 insertions(+), 32 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index bf6f3b52c4b..865078927fb 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -43,6 +43,11 @@ #define HAVE_ERRNO_AS_DEFINE #endif /* __CYGWIN__ */ +/* Determine when to use "#pragma interface" */ +#if !defined(__CYGWIN__) && !defined(__ICC) && (__GNUC__ < 3) +#define USE_PRAGMA_INTERFACE +#endif + #if defined(i386) && !defined(__i386__) #define __i386__ #endif diff --git a/include/raid.h b/include/raid.h index 04c54393e54..c840afcbaab 100644 --- a/include/raid.h +++ b/include/raid.h @@ -89,7 +89,7 @@ extern "C" { #ifdef __cplusplus } -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/examples/ha_archive.h b/sql/examples/ha_archive.h index 855d756368d..7ab463b6661 100644 --- a/sql/examples/ha_archive.h +++ b/sql/examples/ha_archive.h @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/examples/ha_example.h b/sql/examples/ha_example.h index 3c6ce4220ee..ae72e5bb275 100644 --- a/sql/examples/ha_example.h +++ b/sql/examples/ha_example.h @@ -21,7 +21,7 @@ that you can implement. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/field.h b/sql/field.h index f19771c3f9c..1d7669d540d 100644 --- a/sql/field.h +++ b/sql/field.h @@ -20,7 +20,7 @@ variables must declare the size_of() member function. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index 25d3e128502..1d4823bbdc0 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_blackhole.h b/sql/ha_blackhole.h index b6f924e94b9..84a386e17f8 100644 --- a/sql/ha_blackhole.h +++ b/sql/ha_blackhole.h @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_heap.h b/sql/ha_heap.h index f36e9f31c55..60e2e84c5d2 100644 --- a/sql/ha_heap.h +++ b/sql/ha_heap.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index edf428669d8..d336811a1eb 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -21,7 +21,7 @@ Innodb */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_isam.h b/sql/ha_isam.h index b3e932696cb..1f9b8eb28fe 100644 --- a/sql/ha_isam.h +++ b/sql/ha_isam.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_isammrg.h b/sql/ha_isammrg.h index 657e5060272..82a2e312ca3 100644 --- a/sql/ha_isammrg.h +++ b/sql/ha_isammrg.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h index 1e6cf2f4ada..b256d4777f9 100644 --- a/sql/ha_myisam.h +++ b/sql/ha_myisam.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h index 6058c32c805..3bc9c11d4be 100644 --- a/sql/ha_myisammrg.h +++ b/sql/ha_myisammrg.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 7de5dd503e7..439b4855147 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -21,7 +21,7 @@ /* The class defining a handle to an NDB Cluster table */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/handler.h b/sql/handler.h index d2f77c4149a..df623afcd79 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -17,7 +17,7 @@ /* Definitions for parameters to do with handler-routines */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item.h b/sql/item.h index d576fbbc60a..cbb65857027 100644 --- a/sql/item.h +++ b/sql/item.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 37b0674a094..bea8250de9d 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -17,7 +17,7 @@ /* compare and test functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_func.h b/sql/item_func.h index 288db3a148c..398efa837bd 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -17,7 +17,7 @@ /* Function items used by mysql */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 79e4f804a04..5f060416ff3 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -19,7 +19,7 @@ #ifdef HAVE_SPATIAL -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 323b52b826c..e576b2c2a7e 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -17,7 +17,8 @@ /* This file defines all string functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE +#error PRAGMA #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_subselect.h b/sql/item_subselect.h index a6e005d5d26..20ba838e61c 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -16,7 +16,7 @@ /* subselect Item */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_sum.h b/sql/item_sum.h index dab136e4716..22f57712694 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -17,7 +17,7 @@ /* classes for sum functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index cc2709bf555..1a30b24b7ce 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -17,7 +17,7 @@ /* Function items used by mysql */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/opt_range.h b/sql/opt_range.h index 5a2044a59f4..edecdcc6282 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -20,7 +20,7 @@ #ifndef _opt_range_h #define _opt_range_h -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/procedure.h b/sql/procedure.h index abe50bdc0a0..0a1e9ddfa2f 100644 --- a/sql/procedure.h +++ b/sql/procedure.h @@ -17,7 +17,7 @@ /* When using sql procedures */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/protocol.h b/sql/protocol.h index a3b6da55da3..32d6acccddf 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/set_var.h b/sql/set_var.h index 080a2a95ae0..d452ba03367 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -16,7 +16,7 @@ /* Classes to support the SET command */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_class.h b/sql/sql_class.h index 703bb030ab9..fbd60373498 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -17,7 +17,7 @@ /* Classes in mysql */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_list.h b/sql/sql_list.h index be3e29b0c62..45a6b5066eb 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_select.h b/sql/sql_select.h index caf4574fbec..7e69eca4683 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -17,7 +17,7 @@ /* classes to use when handling where clause */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_string.h b/sql/sql_string.h index 8dff5558120..31cdd6efb8a 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -16,7 +16,7 @@ /* This file is originally from the mysql distribution. Coded by monty */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_udf.h b/sql/sql_udf.h index d1f99a6d232..54d2267cac5 100644 --- a/sql/sql_udf.h +++ b/sql/sql_udf.h @@ -17,7 +17,7 @@ /* This file defines structures needed by udf functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface #endif diff --git a/sql/tztime.h b/sql/tztime.h index 2214c1b29d6..e1ff71b6703 100644 --- a/sql/tztime.h +++ b/sql/tztime.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class interface */ #endif From 0d17895910441f63eebb91878840ff2762811484 Mon Sep 17 00:00:00 2001 From: "joreland@mysql.com" <> Date: Wed, 4 May 2005 18:40:54 +0200 Subject: [PATCH 04/58] bug#10358 - ndb Cluster failure with non started nodes can result in timedout transactions --- ndb/src/mgmapi/mgmapi.cpp | 6 ++++++ ndb/src/ndbapi/ClusterMgr.cpp | 13 +++++++------ ndb/src/ndbapi/ClusterMgr.hpp | 14 ++++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp index a8931fb32ea..863f54ce51a 100644 --- a/ndb/src/mgmapi/mgmapi.cpp +++ b/ndb/src/mgmapi/mgmapi.cpp @@ -857,7 +857,10 @@ ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes, const int * node_list, args.put("initialstart", initial); args.put("nostart", nostart); const Properties *reply; + const int timeout = handle->read_timeout; + handle->read_timeout= 5*60*1000; // 5 minutes reply = ndb_mgm_call(handle, restart_reply, "restart all", &args); + handle->read_timeout= timeout; CHECK_REPLY(reply, -1); BaseString result; @@ -890,7 +893,10 @@ ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes, const int * node_list, args.put("nostart", nostart); const Properties *reply; + const int timeout = handle->read_timeout; + handle->read_timeout= 5*60*1000; // 5 minutes reply = ndb_mgm_call(handle, restart_reply, "restart node", &args); + handle->read_timeout= timeout; if(reply != NULL) { BaseString result; reply->get("result", result); diff --git a/ndb/src/ndbapi/ClusterMgr.cpp b/ndb/src/ndbapi/ClusterMgr.cpp index 1fe0cedbd6c..9603ddf7751 100644 --- a/ndb/src/ndbapi/ClusterMgr.cpp +++ b/ndb/src/ndbapi/ClusterMgr.cpp @@ -66,6 +66,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade): { ndbSetOwnVersion(); clusterMgrThreadMutex = NdbMutex_Create(); + noOfAliveNodes= 0; noOfConnectedNodes= 0; theClusterMgrThread= 0; } @@ -335,9 +336,9 @@ ClusterMgr::execAPI_REGCONF(const Uint32 * theData){ node.m_state = apiRegConf->nodeState; if (node.compatible && (node.m_state.startLevel == NodeState::SL_STARTED || node.m_state.startLevel == NodeState::SL_SINGLEUSER)){ - node.m_alive = true; + set_node_alive(node, true); } else { - node.m_alive = false; + set_node_alive(node, false); }//if node.hbSent = 0; node.hbCounter = 0; @@ -360,7 +361,7 @@ ClusterMgr::execAPI_REGREF(const Uint32 * theData){ assert(node.defined == true); node.compatible = false; - node.m_alive = false; + set_node_alive(node, false); node.m_state = NodeState::SL_NOTHING; node.m_info.m_version = ref->version; @@ -437,7 +438,7 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){ Node & theNode = theNodes[nodeId]; - theNode.m_alive = false; + set_node_alive(theNode, false); if(theNode.connected) theFacade.doDisconnect(nodeId); @@ -449,8 +450,8 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){ } theNode.nfCompleteRep = false; - - if(noOfConnectedNodes == 0){ + + if(noOfAliveNodes == 0){ NFCompleteRep rep; for(Uint32 i = 1; i Date: Thu, 5 May 2005 10:34:39 +0200 Subject: [PATCH 05/58] bug#10142 - ndb unique index post review fixes --- ndb/src/kernel/blocks/dbtc/DbtcMain.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index c1ce1613b35..ca97a5bce6d 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -11165,19 +11165,14 @@ void Dbtc::execTCINDXREQ(Signal* signal) regApiPtr->transid[0] = tcIndxReq->transId1; regApiPtr->transid[1] = tcIndxReq->transId2; }//if - ndbout_c("here"); if (ERROR_INSERTED(8036) || !seizeIndexOperation(regApiPtr, indexOpPtr)) { jam(); // Failed to allocate index operation - TcIndxRef * const tcIndxRef = (TcIndxRef *)signal->getDataPtrSend(); - - tcIndxRef->connectPtr = tcIndxReq->senderData; - tcIndxRef->transId[0] = regApiPtr->transid[0]; - tcIndxRef->transId[1] = regApiPtr->transid[1]; - tcIndxRef->errorCode = 288; - sendSignal(regApiPtr->ndbapiBlockref, GSN_TCINDXREF, signal, - TcIndxRef::SignalLength, JBB); + terrorCode = 288; + regApiPtr->m_exec_flag |= TcKeyReq::getExecuteFlag(tcIndxRequestInfo); + apiConnectptr = transPtr; + abortErrorLab(signal); return; } TcIndexOperation* indexOp = indexOpPtr.p; From 208e534acccde1bac2c688fdde0b87ee1ba5100f Mon Sep 17 00:00:00 2001 From: "joreland@mysql.com" <> Date: Thu, 5 May 2005 11:09:00 +0200 Subject: [PATCH 06/58] ndb - testNodeRestart -n LateCommit increase no of rows so that the node failure will "guaranteed" produce an aborted transaction --- ndb/test/ndbapi/testNodeRestart.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndb/test/ndbapi/testNodeRestart.cpp b/ndb/test/ndbapi/testNodeRestart.cpp index a50df91908c..9c25d715d07 100644 --- a/ndb/test/ndbapi/testNodeRestart.cpp +++ b/ndb/test/ndbapi/testNodeRestart.cpp @@ -359,7 +359,7 @@ int runLateCommit(NDBT_Context* ctx, NDBT_Step* step){ if(hugoOps.startTransaction(pNdb) != 0) return NDBT_FAILED; - if(hugoOps.pkUpdateRecord(pNdb, 1) != 0) + if(hugoOps.pkUpdateRecord(pNdb, 1, 128) != 0) return NDBT_FAILED; if(hugoOps.execute_NoCommit(pNdb) != 0) From 749a1f9a2b7438d11fe52af35b200b95fa1a5bba Mon Sep 17 00:00:00 2001 From: "joreland@mysql.com" <> Date: Fri, 6 May 2005 14:44:43 +0200 Subject: [PATCH 07/58] ndb - add support for mysql servers in autotest --- ndb/test/run-test/main.cpp | 41 ++++++++++++++++------------------ ndb/test/run-test/run-test.hpp | 1 + 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp index 02c2cc862a3..842f658f5b6 100644 --- a/ndb/test/run-test/main.cpp +++ b/ndb/test/run-test/main.cpp @@ -116,10 +116,7 @@ main(int argc, const char ** argv){ */ if(restart){ g_logger.info("(Re)starting ndb processes"); - if(!stop_processes(g_config, atrt_process::NDB_MGM)) - goto end; - - if(!stop_processes(g_config, atrt_process::NDB_DB)) + if(!stop_processes(g_config, ~0)) goto end; if(!start_processes(g_config, atrt_process::NDB_MGM)) @@ -142,6 +139,9 @@ main(int argc, const char ** argv){ goto end; started: + if(!start_processes(g_config, p_servers)) + goto end; + g_logger.info("Ndb start completed"); } @@ -158,9 +158,6 @@ main(int argc, const char ** argv){ if(!setup_test_case(g_config, test_case)) goto end; - if(!start_processes(g_config, p_servers)) - goto end; - if(!start_processes(g_config, p_clients)) goto end; @@ -201,9 +198,6 @@ main(int argc, const char ** argv){ if(!stop_processes(g_config, p_clients)) goto end; - if(!stop_processes(g_config, p_servers)) - goto end; - if(!gather_result(g_config, &result)) goto end; @@ -476,21 +470,18 @@ setup_config(atrt_config& config){ proc.m_proc.m_path.assign(dir).append("/libexec/mysqld"); proc.m_proc.m_args = "--core-file --ndbcluster"; proc.m_proc.m_cwd.appfmt("%d.mysqld", index); - if(mysql_port_offset > 0 || g_mysqld_use_base){ - // setup mysql specific stuff - const char * basedir = proc.m_proc.m_cwd.c_str(); - proc.m_proc.m_args.appfmt("--datadir=%s", basedir); - proc.m_proc.m_args.appfmt("--pid-file=%s/mysql.pid", basedir); - proc.m_proc.m_args.appfmt("--socket=%s/mysql.sock", basedir); - proc.m_proc.m_args.appfmt("--port=%d", - g_default_base_port-(++mysql_port_offset)); - } } else if(split1[0] == "api"){ proc.m_type = atrt_process::NDB_API; proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_api"); proc.m_proc.m_path = ""; proc.m_proc.m_args = ""; proc.m_proc.m_cwd.appfmt("%d.ndb_api", index); + } else if(split1[0] == "mysql"){ + proc.m_type = atrt_process::MYSQL_CLIENT; + proc.m_proc.m_name.assfmt("%d-%s", index, "mysql"); + proc.m_proc.m_path = ""; + proc.m_proc.m_args = ""; + proc.m_proc.m_cwd.appfmt("%d.mysql", index); } else { g_logger.critical("%s:%d: Unhandled process type: %s", g_process_config_filename, lineno, @@ -913,6 +904,11 @@ read_test_case(FILE * file, atrt_testcase& tc, int& line){ tc.m_report= true; else tc.m_report= false; + + if(p.get("run-all", &mt) && strcmp(mt, "yes") == 0) + tc.m_run_all= true; + else + tc.m_run_all= false; return true; } @@ -928,16 +924,17 @@ setup_test_case(atrt_config& config, const atrt_testcase& tc){ size_t i = 0; for(; im_base_dir.c_str(), tc.m_command.c_str()); proc.m_proc.m_args.assign(tc.m_args); - break; + if(!tc.m_run_all) + break; } } for(i++; i Date: Fri, 6 May 2005 15:37:51 +0200 Subject: [PATCH 08/58] ndb - autotest update make-config script --- ndb/test/run-test/make-config.sh | 509 ++++--------------------------- 1 file changed, 64 insertions(+), 445 deletions(-) diff --git a/ndb/test/run-test/make-config.sh b/ndb/test/run-test/make-config.sh index 5394b0654d4..f76ee320a99 100755 --- a/ndb/test/run-test/make-config.sh +++ b/ndb/test/run-test/make-config.sh @@ -1,465 +1,84 @@ #!/bin/sh -# NAME -# make-config.sh - Makes a config file for mgm server -# -# SYNOPSIS -# make-config.sh [ -t