summaryrefslogtreecommitdiff
path: root/ndb/src/ndbapi
diff options
context:
space:
mode:
authorunknown <ndbdev@eel.hemma.oreland.se>2004-08-05 22:19:52 +0200
committerunknown <ndbdev@eel.hemma.oreland.se>2004-08-05 22:19:52 +0200
commite223c07eb18147b809cb885ca267ca43f4870701 (patch)
tree682d9074ab3a5be1182ff2e58fe002059f0ddca1 /ndb/src/ndbapi
parent22306d0590f21ed8a43e92cee8fe591df4e88fe2 (diff)
parentebe79c0b9bbb7bf03cd0ed15e474fed6d74adbff (diff)
downloadmariadb-git-e223c07eb18147b809cb885ca267ca43f4870701.tar.gz
Merge joreland@bk-internal.mysql.com:irix
into eel.hemma.oreland.se:/ndb/clone-mysql-4.1-ndb-daily-2004-08-04 BitKeeper/etc/logging_ok: auto-union ndb/src/common/debugger/signaldata/SignalDataPrint.cpp: Auto merged ndb/src/cw/cpcd/Process.cpp: Auto merged ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: Auto merged ndb/src/kernel/blocks/dbtux/Dbtux.hpp: Auto merged ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp: Auto merged ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp: Auto merged ndb/src/mgmsrv/MgmtSrvr.cpp: Auto merged ndb/test/ndbapi/testBasic.cpp: Auto merged ndb/test/run-test/main.cpp: Auto merged ndb/test/src/HugoTransactions.cpp: Auto merged sql/ha_ndbcluster.cc: Auto merged
Diffstat (limited to 'ndb/src/ndbapi')
-rw-r--r--ndb/src/ndbapi/DictCache.cpp11
-rw-r--r--ndb/src/ndbapi/Ndb.cpp8
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp36
-rw-r--r--ndb/src/ndbapi/NdbEventOperationImpl.cpp12
-rw-r--r--ndb/src/ndbapi/NdbLinHash.hpp12
-rw-r--r--ndb/src/ndbapi/NdbScanFilter.cpp9
-rw-r--r--ndb/src/ndbapi/Ndbinit.cpp5
-rw-r--r--ndb/src/ndbapi/TransporterFacade.cpp30
8 files changed, 78 insertions, 45 deletions
diff --git a/ndb/src/ndbapi/DictCache.cpp b/ndb/src/ndbapi/DictCache.cpp
index f6f2106f2aa..5f620f77906 100644
--- a/ndb/src/ndbapi/DictCache.cpp
+++ b/ndb/src/ndbapi/DictCache.cpp
@@ -157,6 +157,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab)
void
GlobalDictCache::drop(NdbTableImpl * tab)
{
+ unsigned i;
const Uint32 len = strlen(tab->m_internalName.c_str());
Vector<TableVersion> * vers =
m_tableHash.getData(tab->m_internalName.c_str(), len);
@@ -173,7 +174,7 @@ GlobalDictCache::drop(NdbTableImpl * tab)
abort();
}
- for(unsigned i = 0; i < sz; i++){
+ for(i = 0; i < sz; i++){
TableVersion & ver = (* vers)[i];
if(ver.m_impl == tab){
if(ver.m_refCount == 0 || ver.m_status == RETREIVING ||
@@ -193,7 +194,7 @@ GlobalDictCache::drop(NdbTableImpl * tab)
}
}
- for(unsigned i = 0; i<sz; i++){
+ for(i = 0; i<sz; i++){
TableVersion & ver = (* vers)[i];
ndbout_c("%d: version: %d refCount: %d status: %d impl: %p",
i, ver.m_version, ver.m_refCount, ver.m_status, ver.m_impl);
@@ -204,6 +205,7 @@ GlobalDictCache::drop(NdbTableImpl * tab)
void
GlobalDictCache::release(NdbTableImpl * tab){
+ unsigned i;
const Uint32 len = strlen(tab->m_internalName.c_str());
Vector<TableVersion> * vers =
m_tableHash.getData(tab->m_internalName.c_str(), len);
@@ -220,7 +222,7 @@ GlobalDictCache::release(NdbTableImpl * tab){
abort();
}
- for(unsigned i = 0; i < sz; i++){
+ for(i = 0; i < sz; i++){
TableVersion & ver = (* vers)[i];
if(ver.m_impl == tab){
if(ver.m_refCount == 0 || ver.m_status == RETREIVING ||
@@ -235,7 +237,7 @@ GlobalDictCache::release(NdbTableImpl * tab){
}
}
- for(unsigned i = 0; i<sz; i++){
+ for(i = 0; i<sz; i++){
TableVersion & ver = (* vers)[i];
ndbout_c("%d: version: %d refCount: %d status: %d impl: %p",
i, ver.m_version, ver.m_refCount, ver.m_status, ver.m_impl);
@@ -244,3 +246,4 @@ GlobalDictCache::release(NdbTableImpl * tab){
abort();
}
+template class Vector<GlobalDictCache::TableVersion>;
diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp
index 5fff137b54f..9c86d382f8f 100644
--- a/ndb/src/ndbapi/Ndb.cpp
+++ b/ndb/src/ndbapi/Ndb.cpp
@@ -958,13 +958,13 @@ Ndb::StartTransactionNodeSelectionData::init(Uint32 noOfNodes,
*/
{
fragment2PrimaryNodeMap = new Uint32[noOfFragments];
-
- for(Uint32 i = 0; i<noOfNodes; i++){
+ Uint32 i;
+ for(i = 0; i<noOfNodes; i++){
fragment2PrimaryNodeMap[i] = nodeIds[i];
}
// Sort them (bubble sort)
- for(Uint32 i = 0; i<noOfNodes-1; i++)
+ for(i = 0; i<noOfNodes-1; i++)
for(Uint32 j = i+1; j<noOfNodes; j++)
if(fragment2PrimaryNodeMap[i] > fragment2PrimaryNodeMap[j]){
Uint32 tmp = fragment2PrimaryNodeMap[i];
@@ -972,7 +972,7 @@ Ndb::StartTransactionNodeSelectionData::init(Uint32 noOfNodes,
fragment2PrimaryNodeMap[j] = tmp;
}
- for(Uint32 i = 0; i<noOfNodes; i++){
+ for(i = 0; i<noOfNodes; i++){
fragment2PrimaryNodeMap[i+noOfNodes] = fragment2PrimaryNodeMap[i];
}
}
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index 004ad531b65..6e95f5c5622 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -383,7 +383,8 @@ void
NdbTableImpl::buildColumnHash(){
const Uint32 size = m_columns.size();
- for(size_t i = 31; i >= 0; i--){
+ size_t i;
+ for(i = 31; i >= 0; i--){
if(((1 << i) & size) != 0){
m_columnHashMask = (1 << (i + 1)) - 1;
break;
@@ -392,7 +393,7 @@ NdbTableImpl::buildColumnHash(){
Vector<Uint32> hashValues;
Vector<Vector<Uint32> > chains; chains.fill(size, hashValues);
- for(size_t i = 0; i<size; i++){
+ for(i = 0; i<size; i++){
Uint32 hv = Hash(m_columns[i]->getName()) & 0xFFFE;
Uint32 bucket = hv & m_columnHashMask;
bucket = (bucket < size ? bucket : bucket - size);
@@ -406,7 +407,7 @@ NdbTableImpl::buildColumnHash(){
m_columnHash.fill((unsigned)size-1, tmp); // Default no chaining
Uint32 pos = 0; // In overflow vector
- for(size_t i = 0; i<size; i++){
+ for(i = 0; i<size; i++){
Uint32 sz = chains[i].size();
if(sz == 1){
Uint32 col = chains[i][0];
@@ -1314,6 +1315,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
NdbTableImpl & impl,
bool alter)
{
+ unsigned i;
if((unsigned)impl.getNoOfPrimaryKeys() > NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY){
m_error.code = 4317;
return -1;
@@ -1339,7 +1341,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
bool haveAutoIncrement = false;
Uint64 autoIncrementValue;
- for(unsigned i = 0; i<sz; i++){
+ for(i = 0; i<sz; i++){
const NdbColumnImpl * col = impl.m_columns[i];
if(col == 0)
continue;
@@ -1383,7 +1385,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
abort();
}
- for(unsigned i = 0; i<sz; i++){
+ for(i = 0; i<sz; i++){
const NdbColumnImpl * col = impl.m_columns[i];
if(col == 0)
continue;
@@ -1795,7 +1797,7 @@ NdbDictInterface::createIndex(Ndb & ndb,
{
//validate();
//aggregate();
-
+ unsigned i;
UtilBufferWriter w(m_buffer);
const size_t len = strlen(impl.m_externalName.c_str()) + 1;
if(len > MAX_TAB_NAME_SIZE) {
@@ -1835,7 +1837,7 @@ NdbDictInterface::createIndex(Ndb & ndb,
req->setOnline(true);
AttributeList attributeList;
attributeList.sz = impl.m_columns.size();
- for(unsigned i = 0; i<attributeList.sz; i++){
+ for(i = 0; i<attributeList.sz; i++){
const NdbColumnImpl* col =
table.getColumn(impl.m_columns[i]->m_name.c_str());
if(col == 0){
@@ -1860,7 +1862,7 @@ NdbDictInterface::createIndex(Ndb & ndb,
}
if (it == DictTabInfo::UniqueHashIndex) {
// Sort index attributes according to primary table (using insertion sort)
- for(unsigned i = 1; i < attributeList.sz; i++) {
+ for(i = 1; i < attributeList.sz; i++) {
unsigned int temp = attributeList.id[i];
unsigned int j = i;
while((j > 0) && (attributeList.id[j - 1] > temp)) {
@@ -1870,7 +1872,7 @@ NdbDictInterface::createIndex(Ndb & ndb,
attributeList.id[j] = temp;
}
// Check for illegal duplicate attributes
- for(unsigned i = 0; i<attributeList.sz; i++) {
+ for(i = 0; i<attributeList.sz; i++) {
if ((i != (attributeList.sz - 1)) &&
(attributeList.id[i] == attributeList.id[i+1])) {
m_error.code = 4258;
@@ -2050,6 +2052,7 @@ NdbDictInterface::execDROP_INDX_REF(NdbApiSignal * signal,
int
NdbDictionaryImpl::createEvent(NdbEventImpl & evnt)
{
+ int i;
NdbTableImpl* tab = getTable(evnt.getTable());
if(tab == 0){
@@ -2072,7 +2075,7 @@ NdbDictionaryImpl::createEvent(NdbEventImpl & evnt)
int attributeList_sz = evnt.m_attrIds.size();
- for (int i = 0; i < attributeList_sz; i++) {
+ for (i = 0; i < attributeList_sz; i++) {
NdbColumnImpl *col_impl = table.getColumn(evnt.m_attrIds[i]);
if (col_impl) {
evnt.m_facade->addColumn(*(col_impl->m_facade));
@@ -2093,7 +2096,7 @@ NdbDictionaryImpl::createEvent(NdbEventImpl & evnt)
int pk_count = 0;
evnt.m_attrListBitmask.clear();
- for(int i = 0; i<attributeList_sz; i++){
+ for(i = 0; i<attributeList_sz; i++){
const NdbColumnImpl* col =
table.getColumn(evnt.m_columns[i]->m_name.c_str());
if(col == 0){
@@ -2111,7 +2114,7 @@ NdbDictionaryImpl::createEvent(NdbEventImpl & evnt)
}
// Sort index attributes according to primary table (using insertion sort)
- for(int i = 1; i < attributeList_sz; i++) {
+ for(i = 1; i < attributeList_sz; i++) {
NdbColumnImpl* temp = evnt.m_columns[i];
unsigned int j = i;
while((j > 0) && (evnt.m_columns[j - 1]->m_attrId > temp->m_attrId)) {
@@ -2121,7 +2124,7 @@ NdbDictionaryImpl::createEvent(NdbEventImpl & evnt)
evnt.m_columns[j] = temp;
}
// Check for illegal duplicate attributes
- for(int i = 1; i<attributeList_sz; i++) {
+ for(i = 1; i<attributeList_sz; i++) {
if (evnt.m_columns[i-1]->m_attrId == evnt.m_columns[i]->m_attrId) {
m_error.code = 4258;
return -1;
@@ -2818,3 +2821,10 @@ NdbDictInterface::execLIST_TABLES_CONF(NdbApiSignal* signal,
m_waiter.signal(NO_WAIT);
}
}
+
+template class Vector<int>;
+template class Vector<Uint32>;
+template class Vector<Vector<Uint32> >;
+template class Vector<NdbTableImpl*>;
+template class Vector<NdbColumnImpl*>;
+
diff --git a/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/ndb/src/ndbapi/NdbEventOperationImpl.cpp
index 6730b637684..f5e683b1c29 100644
--- a/ndb/src/ndbapi/NdbEventOperationImpl.cpp
+++ b/ndb/src/ndbapi/NdbEventOperationImpl.cpp
@@ -93,11 +93,12 @@ NdbEventOperationImpl::NdbEventOperationImpl(NdbEventOperation &N,
NdbEventOperationImpl::~NdbEventOperationImpl()
{
+ int i;
if (sdata) NdbMem_Free(sdata);
- for (int i=0 ; i<3; i++) {
+ for (i=0 ; i<3; i++) {
if (ptr[i].p) NdbMem_Free(ptr[i].p);
}
- for (int i=0 ; i<2; i++) {
+ for (i=0 ; i<2; i++) {
NdbRecAttr *p = theFirstRecAttrs[i];
while (p) {
NdbRecAttr *p_next = p->next();
@@ -1225,8 +1226,9 @@ NdbGlobalEventBuffer::real_wait(NdbGlobalEventBufferHandle *h,
int aMillisecondNumber)
{
// check if there are anything in any of the buffers
+ int i;
int n = 0;
- for (int i = 0; i < h->m_nids; i++)
+ for (i = 0; i < h->m_nids; i++)
n += hasData(h->m_bufferIds[i]);
if (n) return n;
@@ -1235,7 +1237,9 @@ NdbGlobalEventBuffer::real_wait(NdbGlobalEventBufferHandle *h,
return -1;
n = 0;
- for (int i = 0; i < h->m_nids; i++)
+ for (i = 0; i < h->m_nids; i++)
n += hasData(h->m_bufferIds[i]);
return n;
}
+
+template class Vector<NdbGlobalEventBufferHandle*>;
diff --git a/ndb/src/ndbapi/NdbLinHash.hpp b/ndb/src/ndbapi/NdbLinHash.hpp
index f67d4e60200..5d0d52a31d8 100644
--- a/ndb/src/ndbapi/NdbLinHash.hpp
+++ b/ndb/src/ndbapi/NdbLinHash.hpp
@@ -165,13 +165,14 @@ NdbLinHash<C>::createHashTable() {
max = SEGMENTSIZE - 1;
slack = SEGMENTSIZE * MAXLOADFCTR;
directory[0] = new Segment_t();
-
+ int i;
+
/* The first segment cleared before used */
- for(int i = 0; i < SEGMENTSIZE; i++ )
+ for(i = 0; i < SEGMENTSIZE; i++ )
directory[0]->elements[i] = 0;
/* clear the rest of the directory */
- for( int i = 1; i < DIRECTORYSIZE; i++)
+ for(i = 1; i < DIRECTORYSIZE; i++)
directory[i] = 0;
}
@@ -203,7 +204,8 @@ NdbLinHash<C>::insertKey( const char* str, Uint32 len, Uint32 lkey1, C* data )
* chain=chainp will copy the contents of HASH_T into chain
*/
NdbElement_t<C> * oldChain = 0;
- for(NdbElement_t<C> * chain = *chainp; chain != 0; chain = chain->next){
+ NdbElement_t<C> * chain;
+ for(chain = *chainp; chain != 0; chain = chain->next){
if(chain->len == len && !memcmp(chain->str, str, len))
return -1; /* Element already exists */
else
@@ -211,7 +213,7 @@ NdbLinHash<C>::insertKey( const char* str, Uint32 len, Uint32 lkey1, C* data )
}
/* New entry */
- NdbElement_t<C> * chain = new NdbElement_t<C>();
+ chain = new NdbElement_t<C>();
chain->len = len;
chain->hash = hash;
chain->localkey1 = lkey1;
diff --git a/ndb/src/ndbapi/NdbScanFilter.cpp b/ndb/src/ndbapi/NdbScanFilter.cpp
index 9542b226d7d..eace1a0acf5 100644
--- a/ndb/src/ndbapi/NdbScanFilter.cpp
+++ b/ndb/src/ndbapi/NdbScanFilter.cpp
@@ -337,7 +337,6 @@ static const tab2 table2[] = {
const int tab_sz = sizeof(table)/sizeof(table[0]);
const int tab2_sz = sizeof(table2)/sizeof(table2[0]);
-template<typename T>
int
matchType(const NdbDictionary::Column * col){
return 1;
@@ -382,7 +381,7 @@ NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition op,
return -1;
}
- if(!matchType<T>(col)){
+ if(!matchType(col)){
/**
* Code not reached
*/
@@ -777,3 +776,9 @@ main(void){
return 0;
}
#endif
+
+template class Vector<NdbScanFilterImpl::State>;
+template int NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition, Uint32 attrId, Uint32);
+template int NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition, Uint32 attrId, Uint64);
+
+
diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp
index f451ba885d4..641919d771b 100644
--- a/ndb/src/ndbapi/Ndbinit.cpp
+++ b/ndb/src/ndbapi/Ndbinit.cpp
@@ -111,12 +111,13 @@ Ndb::Ndb( const char* aDataBase , const char* aSchema) :
theCurrentConnectCounter = 1;
theCurrentConnectIndex = 0;
- for (int i = 0; i < MAX_NDB_NODES ; i++) {
+ int i;
+ for (i = 0; i < MAX_NDB_NODES ; i++) {
theConnectionArray[i] = NULL;
the_release_ind[i] = 0;
theDBnodes[i] = 0;
}//forg
- for (int i = 0; i < 2048 ; i++) {
+ for (i = 0; i < 2048 ; i++) {
theFirstTupleId[i] = 0;
theLastTupleId[i] = 0;
}//for
diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp
index 293136b9783..6a25db560c9 100644
--- a/ndb/src/ndbapi/TransporterFacade.cpp
+++ b/ndb/src/ndbapi/TransporterFacade.cpp
@@ -168,13 +168,6 @@ setSignalLog(){
#endif
#endif
-// These symbols are needed, but not used in the API
-int g_sectionSegmentPool;
-struct ErrorReporter {
- void handleAssert(const char*, const char*, int);
-};
-void ErrorReporter::handleAssert(const char*, const char*, int) {}
-
/**
* The execute function : Handle received signal
*/
@@ -318,6 +311,14 @@ execute(void * callbackObj, SignalHeader * const header,
}
}
+// These symbols are needed, but not used in the API
+void
+SignalLoggerManager::printSegmentedSection(FILE *, const SignalHeader &,
+ const SegmentedSectionPtr ptr[3],
+ unsigned i){
+ abort();
+}
+
void
copy(Uint32 * & insertPtr,
class SectionSegmentPool & thePool, const SegmentedSectionPtr & _ptr){
@@ -462,11 +463,15 @@ void TransporterFacade::threadMainSend(void)
SocketServer socket_server;
theTransporterRegistry->startSending();
- if (!theTransporterRegistry->start_service(socket_server))
- NDB_ASSERT(0, "Unable to start theTransporterRegistry->start_service");
+ if (!theTransporterRegistry->start_service(socket_server)){
+ ndbout_c("Unable to start theTransporterRegistry->start_service");
+ exit(0);
+ }
- if (!theTransporterRegistry->start_clients())
- NDB_ASSERT(0, "Unable to start theTransporterRegistry->start_clients");
+ if (!theTransporterRegistry->start_clients()){
+ ndbout_c("Unable to start theTransporterRegistry->start_clients");
+ exit(0);
+ }
socket_server.startServer();
@@ -1023,3 +1028,6 @@ TransporterFacade::ThreadData::close(int number){
m_statusFunction[number] = 0;
return 0;
}
+
+template class Vector<NodeStatusFunction>;
+template class Vector<TransporterFacade::ThreadData::Object_Execute>;