diff options
-rw-r--r-- | storage/ndb/src/common/portlib/NdbThread.c | 15 | ||||
-rw-r--r-- | storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp | 2 | ||||
-rw-r--r-- | storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp | 2 | ||||
-rw-r--r-- | storage/ndb/src/ndbapi/Ndb.cpp | 7 | ||||
-rw-r--r-- | storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp | 58 | ||||
-rw-r--r-- | storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp | 2 | ||||
-rw-r--r-- | storage/ndb/test/ndbapi/bank/BankLoad.cpp | 2 | ||||
-rwxr-xr-x | storage/ndb/test/run-test/make-config.sh | 2 |
8 files changed, 64 insertions, 26 deletions
diff --git a/storage/ndb/src/common/portlib/NdbThread.c b/storage/ndb/src/common/portlib/NdbThread.c index d501ea2559a..da1c385e2ea 100644 --- a/storage/ndb/src/common/portlib/NdbThread.c +++ b/storage/ndb/src/common/portlib/NdbThread.c @@ -115,10 +115,13 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, pthread_attr_init(&thread_attr); #if (SIZEOF_CHARP == 8) - pthread_attr_setstacksize(&thread_attr, 2*thread_stack_size); -#else - pthread_attr_setstacksize(&thread_attr, thread_stack_size); + thread_stack_size *= 2; +#endif +#ifdef PTHREAD_STACK_MIN + if (thread_stack_size < PTHREAD_STACK_MIN) + thread_stack_size = PTHREAD_STACK_MIN; #endif + pthread_attr_setstacksize(&thread_attr, thread_stack_size); #ifdef USE_PTHREAD_EXTRAS /* Guard stack overflow with a 2k databuffer */ pthread_attr_setguardsize(&thread_attr, 2048); @@ -133,7 +136,11 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, &thread_attr, ndb_thread_wrapper, tmpThread); - assert(result==0); + if (result != 0) + { + NdbMem_Free((char *)tmpThread); + tmpThread = 0; + } pthread_attr_destroy(&thread_attr); DBUG_PRINT("exit",("ret: %lx", tmpThread)); diff --git a/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp index 89fe83f6bf4..b6ca421064f 100644 --- a/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp +++ b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp @@ -66,13 +66,13 @@ struct BlockInfo { }; static BlockInfo ALL_BLOCKS[] = { + { NDBFS_REF, 0 , 2000, 2999 }, { DBTC_REF, 1 , 8000, 8035 }, { DBDIH_REF, 1 , 7000, 7173 }, { DBLQH_REF, 1 , 5000, 5030 }, { DBACC_REF, 1 , 3000, 3999 }, { DBTUP_REF, 1 , 4000, 4007 }, { DBDICT_REF, 1 , 6000, 6003 }, - { NDBFS_REF, 0 , 2000, 2999 }, { NDBCNTR_REF, 0 , 1000, 1999 }, { QMGR_REF, 1 , 1, 999 }, { CMVMI_REF, 1 , 9000, 9999 }, diff --git a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index c371b1cd890..75ab83b2e98 100644 --- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -122,6 +122,8 @@ AsyncFile::doStart() stackSize, (char*)&buf, NDB_THREAD_PRIO_MEAN); + if (theThreadPtr == 0) + ERROR_SET(fatal, NDBD_EXIT_MEMALLOC, "","Could not allocate file system thread"); NdbCondition_Wait(theStartConditionPtr, theStartMutexPtr); diff --git a/storage/ndb/src/ndbapi/Ndb.cpp b/storage/ndb/src/ndbapi/Ndb.cpp index 50f2123a811..8bfedc2f96f 100644 --- a/storage/ndb/src/ndbapi/Ndb.cpp +++ b/storage/ndb/src/ndbapi/Ndb.cpp @@ -1300,7 +1300,12 @@ Uint64 Ndb::getLatestGCI() void Ndb::setReportThreshEventGCISlip(unsigned thresh) { - theEventBuffer->m_gci_slip_thresh= thresh; + if (theEventBuffer->m_free_thresh != thresh) + { + theEventBuffer->m_free_thresh= thresh; + theEventBuffer->m_min_free_thresh= thresh; + theEventBuffer->m_max_free_thresh= 100; + } } void Ndb::setReportThreshEventFreeMem(unsigned thresh) diff --git a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp index a1fc6e87c0d..1fa0c6386be 100644 --- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp @@ -539,6 +539,8 @@ NdbEventBuffer::NdbEventBuffer(Ndb *ndb) : m_latestGCI(0), m_total_alloc(0), m_free_thresh(10), + m_min_free_thresh(10), + m_max_free_thresh(100), m_gci_slip_thresh(3), m_dropped_ev_op(0), m_active_op_count(0) @@ -635,8 +637,6 @@ int NdbEventBuffer::expand(unsigned sz) EventBufData_chunk *chunk_data= (EventBufData_chunk *)NdbMem_Allocate(alloc_size); - m_total_alloc+= alloc_size; - chunk_data->sz= sz; m_allocated_data.push_back(chunk_data); @@ -902,8 +902,8 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep) assert(bucket->m_data.m_count); #endif m_complete_data.m_data.append(bucket->m_data); - reportStatus(); } + reportStatus(); bzero(bucket, sizeof(Gci_container)); bucket->m_gci = gci + ACTIVE_GCI_DIRECTORY_SIZE; bucket->m_gcp_complete_rep_count = m_system_nodes; @@ -1356,23 +1356,47 @@ NdbEventBuffer::reportStatus() else apply_gci= latest_gci; - if (100*m_free_data_sz < m_free_thresh*m_total_alloc || - latest_gci-apply_gci >= m_gci_slip_thresh) + if (100*m_free_data_sz < m_min_free_thresh*m_total_alloc && + m_total_alloc > 1024*1024) + { + /* report less free buffer than m_free_thresh, + next report when more free than 2 * m_free_thresh + */ + m_min_free_thresh= 0; + m_max_free_thresh= 2 * m_free_thresh; + goto send_report; + } + + if (100*m_free_data_sz > m_max_free_thresh*m_total_alloc && + m_total_alloc > 1024*1024) + { + /* report more free than 2 * m_free_thresh + next report when less free than m_free_thresh + */ + m_min_free_thresh= m_free_thresh; + m_max_free_thresh= 100; + goto send_report; + } + if (latest_gci-apply_gci >= m_gci_slip_thresh) { - Uint32 data[8]; - data[0]= NDB_LE_EventBufferStatus; - data[1]= m_total_alloc-m_free_data_sz; - data[2]= m_total_alloc; - data[3]= 0; - data[4]= apply_gci & ~(Uint32)0; - data[5]= apply_gci >> 32; - data[6]= latest_gci & ~(Uint32)0; - data[7]= latest_gci >> 32; - m_ndb->theImpl->send_event_report(data,8); + goto send_report; + } + return; + +send_report: + Uint32 data[8]; + data[0]= NDB_LE_EventBufferStatus; + data[1]= m_total_alloc-m_free_data_sz; + data[2]= m_total_alloc; + data[3]= 0; + data[4]= apply_gci & ~(Uint32)0; + data[5]= apply_gci >> 32; + data[6]= latest_gci & ~(Uint32)0; + data[7]= latest_gci >> 32; + m_ndb->theImpl->send_event_report(data,8); #ifdef VM_TRACE - assert(m_total_alloc >= m_free_data_sz); + assert(m_total_alloc >= m_free_data_sz); #endif - } } template class Vector<Gci_container>; diff --git a/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp b/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp index 0436cea66ce..542a4a594a5 100644 --- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp +++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp @@ -271,7 +271,7 @@ public: unsigned m_total_alloc; // total allocated memory // threshholds to report status - unsigned m_free_thresh; + unsigned m_free_thresh, m_min_free_thresh, m_max_free_thresh; unsigned m_gci_slip_thresh; NdbError m_error; diff --git a/storage/ndb/test/ndbapi/bank/BankLoad.cpp b/storage/ndb/test/ndbapi/bank/BankLoad.cpp index 34947019a51..78fd6c7d678 100644 --- a/storage/ndb/test/ndbapi/bank/BankLoad.cpp +++ b/storage/ndb/test/ndbapi/bank/BankLoad.cpp @@ -23,7 +23,7 @@ */ struct AccountTypesStruct { int id; - const char* descr; + const char descr[64]; }; const AccountTypesStruct accountTypes[] = { { 0, "KASSA"}, diff --git a/storage/ndb/test/run-test/make-config.sh b/storage/ndb/test/run-test/make-config.sh index e82acb8a7dd..a5ea2e58ae6 100755 --- a/storage/ndb/test/run-test/make-config.sh +++ b/storage/ndb/test/run-test/make-config.sh @@ -44,7 +44,7 @@ add_proc (){ ;; mysqld) echo "$proc_no.mysqld" >> $dir_file - echo "[ndb_mgmd]" >> $config_file + echo "[mysqld]" >> $config_file echo "Id: $node_id" >> $config_file echo "HostName: $2" >> $config_file node_id=`expr $node_id + 1` |