diff options
author | unknown <serg@sergbook.mysql.com> | 2004-12-31 15:26:24 +0100 |
---|---|---|
committer | unknown <serg@sergbook.mysql.com> | 2004-12-31 15:26:24 +0100 |
commit | b99bea6704299399c84bd8374ef7f248ff9570c5 (patch) | |
tree | 928b06c231edee4cb95ace87ed30e879e3dcb0fb /ndb/src/ndbapi | |
parent | bd23099be0b22845e8c97e2fb36ee3c6eb0e2491 (diff) | |
parent | 5eaf65ab4be77911eb03cceefac9ecea48c25f71 (diff) | |
download | mariadb-git-b99bea6704299399c84bd8374ef7f248ff9570c5.tar.gz |
manually merged
configure.in:
Auto merged
client/mysqldump.c:
Auto merged
innobase/buf/buf0rea.c:
Auto merged
innobase/dict/dict0load.c:
Auto merged
innobase/fil/fil0fil.c:
Auto merged
innobase/include/fil0fil.h:
Auto merged
innobase/include/row0mysql.h:
Auto merged
innobase/include/trx0trx.h:
Auto merged
innobase/os/os0file.c:
Auto merged
innobase/row/row0ins.c:
Auto merged
innobase/row/row0mysql.c:
Auto merged
innobase/row/row0sel.c:
Auto merged
innobase/srv/srv0start.c:
Auto merged
innobase/trx/trx0trx.c:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysql-test/r/alter_table.result:
Auto merged
mysql-test/r/ctype_ucs.result:
Auto merged
mysql-test/r/func_str.result:
Auto merged
mysql-test/r/grant.result:
Auto merged
mysql-test/r/grant_cache.result:
Auto merged
mysql-test/r/merge.result:
Auto merged
mysql-test/r/ndb_blob.result:
Auto merged
mysql-test/r/ps_1general.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/timezone2.result:
Auto merged
mysql-test/t/ctype_ucs.test:
Auto merged
mysql-test/t/grant.test:
Auto merged
mysql-test/t/merge.test:
Auto merged
mysql-test/t/multi_update.test:
Auto merged
mysql-test/t/mysqldump.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
ndb/src/ndbapi/NdbBlob.cpp:
Auto merged
ndb/src/ndbapi/NdbConnection.cpp:
Auto merged
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Auto merged
ndb/src/ndbapi/NdbOperationDefine.cpp:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/ha_myisammrg.cc:
Auto merged
sql/ha_myisammrg.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/log.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql-common/client.c:
Auto merged
sql/sql_table.cc:
Auto merged
sql/strfunc.cc:
Auto merged
sql/unireg.cc:
Auto merged
vio/vio.c:
Auto merged
vio/viosocket.c:
Auto merged
Diffstat (limited to 'ndb/src/ndbapi')
-rw-r--r-- | ndb/src/ndbapi/Ndb.cpp | 2 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbBlob.cpp | 63 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbBlobImpl.hpp | 39 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbConnection.cpp | 7 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbDictionaryImpl.cpp | 7 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbOperationDefine.cpp | 4 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbOperationInt.cpp | 18 | ||||
-rw-r--r-- | ndb/src/ndbapi/Ndbinit.cpp | 21 | ||||
-rw-r--r-- | ndb/src/ndbapi/ndb_cluster_connection.cpp | 22 |
9 files changed, 110 insertions, 73 deletions
diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp index e9a125922c6..b5493622b70 100644 --- a/ndb/src/ndbapi/Ndb.cpp +++ b/ndb/src/ndbapi/Ndb.cpp @@ -282,7 +282,7 @@ Ndb::waitUntilReady(int timeout) } if (theImpl->m_ndb_cluster_connection.wait_until_ready - (timeout-secondsCounter,30)) + (timeout-secondsCounter,30) < 0) { theError.code = 4009; DBUG_RETURN(-1); diff --git a/ndb/src/ndbapi/NdbBlob.cpp b/ndb/src/ndbapi/NdbBlob.cpp index 0a1433c71f3..c72568f7201 100644 --- a/ndb/src/ndbapi/NdbBlob.cpp +++ b/ndb/src/ndbapi/NdbBlob.cpp @@ -21,6 +21,7 @@ #include <NdbIndexOperation.hpp> #include <NdbRecAttr.hpp> #include <NdbBlob.hpp> +#include "NdbBlobImpl.hpp" #include <NdbScanOperation.hpp> #ifdef NDB_BLOB_DEBUG @@ -85,14 +86,14 @@ void NdbBlob::getBlobTableName(char* btname, const NdbTableImpl* t, const NdbColumnImpl* c) { assert(t != 0 && c != 0 && c->getBlobType()); - memset(btname, 0, BlobTableNameSize); + memset(btname, 0, NdbBlobImpl::BlobTableNameSize); sprintf(btname, "NDB$BLOB_%d_%d", (int)t->m_tableId, (int)c->m_attrId); } void NdbBlob::getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnImpl* c) { - char btname[BlobTableNameSize]; + char btname[NdbBlobImpl::BlobTableNameSize]; getBlobTableName(btname, t, c); bt.setName(btname); bt.setLogging(t->getLogging()); @@ -450,15 +451,15 @@ NdbBlob::getValue(void* data, Uint32 bytes) { DBG("getValue data=" << hex << data << " bytes=" << dec << bytes); if (theGetFlag || theState != Prepared) { - setErrorCode(ErrState); + setErrorCode(NdbBlobImpl::ErrState); return -1; } if (! isReadOp() && ! isScanOp()) { - setErrorCode(ErrUsage); + setErrorCode(NdbBlobImpl::ErrUsage); return -1; } if (data == NULL && bytes != 0) { - setErrorCode(ErrUsage); + setErrorCode(NdbBlobImpl::ErrUsage); return -1; } theGetFlag = true; @@ -472,15 +473,15 @@ NdbBlob::setValue(const void* data, Uint32 bytes) { DBG("setValue data=" << hex << data << " bytes=" << dec << bytes); if (theSetFlag || theState != Prepared) { - setErrorCode(ErrState); + setErrorCode(NdbBlobImpl::ErrState); return -1; } if (! isInsertOp() && ! isUpdateOp() && ! isWriteOp()) { - setErrorCode(ErrUsage); + setErrorCode(NdbBlobImpl::ErrUsage); return -1; } if (data == NULL && bytes != 0) { - setErrorCode(ErrUsage); + setErrorCode(NdbBlobImpl::ErrUsage); return -1; } theSetFlag = true; @@ -512,7 +513,7 @@ NdbBlob::setActiveHook(ActiveHook activeHook, void* arg) { DBG("setActiveHook hook=" << hex << (void*)activeHook << " arg=" << hex << arg); if (theState != Prepared) { - setErrorCode(ErrState); + setErrorCode(NdbBlobImpl::ErrState); return -1; } theActiveHook = activeHook; @@ -531,7 +532,7 @@ NdbBlob::getNull(bool& isNull) return 0; } if (theNullFlag == -1) { - setErrorCode(ErrState); + setErrorCode(NdbBlobImpl::ErrState); return -1; } isNull = theNullFlag; @@ -546,7 +547,7 @@ NdbBlob::setNull() if (theState == Prepared) { return setValue(0, 0); } - setErrorCode(ErrState); + setErrorCode(NdbBlobImpl::ErrState); return -1; } if (theNullFlag) @@ -568,7 +569,7 @@ NdbBlob::getLength(Uint64& len) return 0; } if (theNullFlag == -1) { - setErrorCode(ErrState); + setErrorCode(NdbBlobImpl::ErrState); return -1; } len = theLength; @@ -580,7 +581,7 @@ NdbBlob::truncate(Uint64 length) { DBG("truncate [in] length=" << length); if (theNullFlag == -1) { - setErrorCode(ErrState); + setErrorCode(NdbBlobImpl::ErrState); return -1; } if (theLength > length) { @@ -608,7 +609,7 @@ NdbBlob::getPos(Uint64& pos) { DBG("getPos"); if (theNullFlag == -1) { - setErrorCode(ErrState); + setErrorCode(NdbBlobImpl::ErrState); return -1; } pos = thePos; @@ -620,11 +621,11 @@ NdbBlob::setPos(Uint64 pos) { DBG("setPos pos=" << pos); if (theNullFlag == -1) { - setErrorCode(ErrState); + setErrorCode(NdbBlobImpl::ErrState); return -1; } if (pos > theLength) { - setErrorCode(ErrSeek); + setErrorCode(NdbBlobImpl::ErrSeek); return -1; } thePos = pos; @@ -637,7 +638,7 @@ int NdbBlob::readData(void* data, Uint32& bytes) { if (theState != Active) { - setErrorCode(ErrState); + setErrorCode(NdbBlobImpl::ErrState); return -1; } char* buf = static_cast<char*>(data); @@ -666,7 +667,7 @@ NdbBlob::readDataPrivate(char* buf, Uint32& bytes) } } if (len > 0 && thePartSize == 0) { - setErrorCode(ErrSeek); + setErrorCode(NdbBlobImpl::ErrSeek); return -1; } if (len > 0) { @@ -731,7 +732,7 @@ int NdbBlob::writeData(const void* data, Uint32 bytes) { if (theState != Active) { - setErrorCode(ErrState); + setErrorCode(NdbBlobImpl::ErrState); return -1; } const char* buf = static_cast<const char*>(data); @@ -764,7 +765,7 @@ NdbBlob::writeDataPrivate(const char* buf, Uint32 bytes) } } if (len > 0 && thePartSize == 0) { - setErrorCode(ErrSeek); + setErrorCode(NdbBlobImpl::ErrSeek); return -1; } if (len > 0) { @@ -1081,7 +1082,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* theFillChar = 0x20; break; default: - setErrorCode(ErrUsage); + setErrorCode(NdbBlobImpl::ErrUsage); return -1; } // sizes @@ -1099,7 +1100,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* (bc = bt->getColumn("DATA")) == NULL || bc->getType() != partType || bc->getLength() != (int)thePartSize) { - setErrorCode(ErrTable); + setErrorCode(NdbBlobImpl::ErrTable); return -1; } theBlobTable = &NdbTableImpl::getImpl(*bt); @@ -1120,7 +1121,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* Uint32* data = (Uint32*)theKeyBuf.data; unsigned size = theTable->m_keyLenInWords; if (theNdbOp->getKeyFromTCREQ(data, size) == -1) { - setErrorCode(ErrUsage); + setErrorCode(NdbBlobImpl::ErrUsage); return -1; } } @@ -1129,7 +1130,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* Uint32* data = (Uint32*)theAccessKeyBuf.data; unsigned size = theAccessTable->m_keyLenInWords; if (theNdbOp->getKeyFromTCREQ(data, size) == -1) { - setErrorCode(ErrUsage); + setErrorCode(NdbBlobImpl::ErrUsage); return -1; } } @@ -1158,7 +1159,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* supportedOp = true; } if (! supportedOp) { - setErrorCode(ErrUsage); + setErrorCode(NdbBlobImpl::ErrUsage); return -1; } setState(Prepared); @@ -1204,7 +1205,7 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch) tOp->updateTuple() == -1 || setTableKeyValue(tOp) == -1 || setHeadInlineValue(tOp) == -1) { - setErrorCode(ErrAbort); + setErrorCode(NdbBlobImpl::ErrAbort); return -1; } DBG("add op to update head+inline"); @@ -1434,7 +1435,7 @@ NdbBlob::postExecute(ExecType anExecType) tOp->updateTuple() == -1 || setTableKeyValue(tOp) == -1 || setHeadInlineValue(tOp) == -1) { - setErrorCode(ErrAbort); + setErrorCode(NdbBlobImpl::ErrAbort); return -1; } tOp->m_abortOption = AbortOnError; @@ -1464,7 +1465,7 @@ NdbBlob::preCommit() tOp->updateTuple() == -1 || setTableKeyValue(tOp) == -1 || setHeadInlineValue(tOp) == -1) { - setErrorCode(ErrAbort); + setErrorCode(NdbBlobImpl::ErrAbort); return -1; } tOp->m_abortOption = AbortOnError; @@ -1489,7 +1490,7 @@ NdbBlob::atNextResult() { Uint32* data = (Uint32*)theKeyBuf.data; unsigned size = theTable->m_keyLenInWords; if (((NdbScanOperation*)theNdbOp)->getKeyFromKEYINFO20(data, size) == -1) { - setErrorCode(ErrUsage); + setErrorCode(NdbBlobImpl::ErrUsage); return -1; } } @@ -1545,7 +1546,7 @@ NdbBlob::setErrorCode(NdbOperation* anOp, bool invalidFlag) else if ((code = theNdb->theError.code) != 0) ; else - code = ErrUnknown; + code = NdbBlobImpl::ErrUnknown; setErrorCode(code, invalidFlag); } @@ -1558,7 +1559,7 @@ NdbBlob::setErrorCode(NdbConnection* aCon, bool invalidFlag) else if ((code = theNdb->theError.code) != 0) ; else - code = ErrUnknown; + code = NdbBlobImpl::ErrUnknown; setErrorCode(code, invalidFlag); } diff --git a/ndb/src/ndbapi/NdbBlobImpl.hpp b/ndb/src/ndbapi/NdbBlobImpl.hpp new file mode 100644 index 00000000000..0030e910c52 --- /dev/null +++ b/ndb/src/ndbapi/NdbBlobImpl.hpp @@ -0,0 +1,39 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef NdbBlobImpl_H +#define NdbBlobImpl_H + +class NdbBlobImpl { +public: + STATIC_CONST( BlobTableNameSize = 40 ); + // "Invalid blob attributes or invalid blob parts table" + STATIC_CONST( ErrTable = 4263 ); + // "Invalid usage of blob attribute" + STATIC_CONST( ErrUsage = 4264 ); + // "Method is not valid in current blob state" + STATIC_CONST( ErrState = 4265 ); + // "Invalid blob seek position" + STATIC_CONST( ErrSeek = 4266 ); + // "Corrupted blob value" + STATIC_CONST( ErrCorrupt = 4267 ); + // "Error in blob head update forced rollback of transaction" + STATIC_CONST( ErrAbort = 4268 ); + // "Unknown blob error" + STATIC_CONST( ErrUnknown = 4269 ); +}; + +#endif diff --git a/ndb/src/ndbapi/NdbConnection.cpp b/ndb/src/ndbapi/NdbConnection.cpp index 29959a4ed7e..aa4f68a85b4 100644 --- a/ndb/src/ndbapi/NdbConnection.cpp +++ b/ndb/src/ndbapi/NdbConnection.cpp @@ -361,11 +361,10 @@ NdbConnection::execute(ExecType aTypeOfExec, if (executeNoBlobs(tExecType, abortOption, forceSend) == -1) ret = -1; -#ifndef VM_TRACE - // can happen in complex abort cases - theFirstOpInList = theLastOpInList = NULL; -#else +#ifdef ndb_api_crash_on_complex_blob_abort assert(theFirstOpInList == NULL && theLastOpInList == NULL); +#else + theFirstOpInList = theLastOpInList = NULL; #endif { diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index d39b921072b..b3b8e48edd1 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -34,7 +34,8 @@ #include <AttributeList.hpp> #include <NdbEventOperation.hpp> #include "NdbEventOperationImpl.hpp" -#include "NdbBlob.hpp" +#include <NdbBlob.hpp> +#include "NdbBlobImpl.hpp" #include <AttributeHeader.hpp> #include <my_sys.h> @@ -1381,7 +1382,7 @@ NdbDictionaryImpl::addBlobTables(NdbTableImpl &t) if (! c.getBlobType() || c.getPartSize() == 0) continue; n--; - char btname[NdbBlob::BlobTableNameSize]; + char btname[NdbBlobImpl::BlobTableNameSize]; NdbBlob::getBlobTableName(btname, &t, &c); // Save BLOB table handle NdbTableImpl * cachedBlobTable = getTable(btname); @@ -1789,7 +1790,7 @@ NdbDictionaryImpl::dropBlobTables(NdbTableImpl & t) NdbColumnImpl & c = *t.m_columns[i]; if (! c.getBlobType() || c.getPartSize() == 0) continue; - char btname[NdbBlob::BlobTableNameSize]; + char btname[NdbBlobImpl::BlobTableNameSize]; NdbBlob::getBlobTableName(btname, &t, &c); if (dropTable(btname) != 0) { if (m_error.code != 709){ diff --git a/ndb/src/ndbapi/NdbOperationDefine.cpp b/ndb/src/ndbapi/NdbOperationDefine.cpp index d9aa860f71f..bc960a72d2e 100644 --- a/ndb/src/ndbapi/NdbOperationDefine.cpp +++ b/ndb/src/ndbapi/NdbOperationDefine.cpp @@ -523,7 +523,9 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo, CHARSET_INFO* cs = tAttrInfo->m_cs; // invalid data can crash kernel if (cs != NULL && - (*cs->cset->well_formed_len)(cs, + // fast fix bug#7340 + tAttrInfo->m_type != NdbDictionary::Column::Text && + (*cs->cset->well_formed_len)(cs, aValue, aValue + sizeInBytes, sizeInBytes) != sizeInBytes) { diff --git a/ndb/src/ndbapi/NdbOperationInt.cpp b/ndb/src/ndbapi/NdbOperationInt.cpp index ee7b8132cd1..ace90e35ca4 100644 --- a/ndb/src/ndbapi/NdbOperationInt.cpp +++ b/ndb/src/ndbapi/NdbOperationInt.cpp @@ -15,21 +15,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/************************************************************************************************ -Name: NdbOperationInt.C -Include: -Link: -Author: UABRONM Mikael Ronström UAB/M/MT -Date: 991029 -Version: 0.1 -Description: Interpreted operations in NDB API -Documentation: -Adjust: 991029 UABRONM First version. -************************************************************************************************/ -#include "NdbOperation.hpp" +#include <ndb_global.h> +#include <NdbOperation.hpp> #include "NdbApiSignal.hpp" -#include "NdbConnection.hpp" -#include "Ndb.hpp" +#include <NdbConnection.hpp> +#include <Ndb.hpp> #include "NdbRecAttr.hpp" #include "NdbUtil.hpp" #include "Interpreter.hpp" diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp index e1af7bd4cc5..a11dd842495 100644 --- a/ndb/src/ndbapi/Ndbinit.cpp +++ b/ndb/src/ndbapi/Ndbinit.cpp @@ -204,14 +204,6 @@ Ndb::~Ndb() TransporterFacade::instance()->close(theNdbBlockNumber, theFirstTransId); } - if (global_ndb_cluster_connection != 0) { - theNoOfNdbObjects--; - if(theNoOfNdbObjects == 0){ - delete global_ndb_cluster_connection; - global_ndb_cluster_connection= 0; - } - }//if - // if (theSchemaConToNdbList != NULL) // closeSchemaTransaction(theSchemaConToNdbList); while ( theConIdleList != NULL ) @@ -249,6 +241,19 @@ Ndb::~Ndb() delete theImpl; + /** + * This needs to be put after delete theImpl + * as TransporterFacade::instance is delete by global_ndb_cluster_connection + * and used by theImpl + */ + if (global_ndb_cluster_connection != 0) { + theNoOfNdbObjects--; + if(theNoOfNdbObjects == 0){ + delete global_ndb_cluster_connection; + global_ndb_cluster_connection= 0; + } + }//if + /** * This sleep is to make sure that the transporter * send thread will come in and send any diff --git a/ndb/src/ndbapi/ndb_cluster_connection.cpp b/ndb/src/ndbapi/ndb_cluster_connection.cpp index 98a52786aab..5df707e211d 100644 --- a/ndb/src/ndbapi/ndb_cluster_connection.cpp +++ b/ndb/src/ndbapi/ndb_cluster_connection.cpp @@ -31,6 +31,9 @@ #include <Vector.hpp> #include <md5_hash.hpp> +#include <EventLogger.hpp> +EventLogger g_eventLogger; + static int g_run_connect_thread= 0; #include <NdbMutex.h> @@ -174,7 +177,7 @@ Ndb_cluster_connection_impl::get_next_node(Ndb_cluster_connection_node_iter &ite return node.id; } -Uint32 +unsigned Ndb_cluster_connection::no_db_nodes() { return m_impl.m_all_nodes.size(); @@ -219,16 +222,8 @@ Ndb_cluster_connection::wait_until_ready(int timeout, else if (foundAliveNode > 0) { noChecksSinceFirstAliveFound++; - if (timeout_after_first_alive >= 0) - { - if (noChecksSinceFirstAliveFound > timeout_after_first_alive) - DBUG_RETURN(0); - } - else // timeout_after_first_alive < 0 - { - if (noChecksSinceFirstAliveFound > -timeout_after_first_alive) - DBUG_RETURN(-1); - } + if (noChecksSinceFirstAliveFound > timeout_after_first_alive) + DBUG_RETURN(1); } else if (secondsCounter >= timeout) { // no alive nodes and timed out @@ -256,6 +251,11 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char * { DBUG_ENTER("Ndb_cluster_connection"); DBUG_PRINT("enter",("Ndb_cluster_connection this=0x%x", this)); + + g_eventLogger.createConsoleHandler(); + g_eventLogger.setCategory("NdbApi"); + g_eventLogger.enable(Logger::LL_ON, Logger::LL_ERROR); + m_transporter_facade= TransporterFacade::theFacadeInstance= new TransporterFacade(); |