From: Mikael Ronstrom Date: January 18 2012 6:28pm Subject: bzr push into mysql-5.5-cluster-7.2 branch (mikael.ronstrom:3705 to 3709) List-Archive: http://lists.mysql.com/commits/142471 Message-Id: <201201181829.q0IITXIs014091@dator6> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3709 Mikael Ronstrom 2012-01-18 Remove unnecessary job queue pages, all threads don't communicate with each other modified: storage/ndb/src/kernel/vm/mt.cpp 3708 Mikael Ronstrom 2012-01-18 Fix seize_list to always return a proper list modified: storage/ndb/src/kernel/vm/mt.cpp 3707 Mikael Ronstrom 2012-01-18 remove erroneus require modified: mysql-test/include/default_ndbd.cnf storage/ndb/src/kernel/vm/mt.cpp 3706 Mikael Ronstrom 2012-01-17 Make it possible to also have 12 LQH threads, fix back flexAsynch, limit TC threads to 16 modified: storage/ndb/include/kernel/ndb_limits.h storage/ndb/src/kernel/vm/mt_thr_config.cpp storage/ndb/src/mgmsrv/ConfigInfo.cpp storage/ndb/test/ndbapi/flexAsynch.cpp 3705 Mikael Ronstrom 2012-01-13 Avoid eternal loop modified: storage/ndb/test/ndbapi/flexAsynch.cpp === modified file 'mysql-test/include/default_ndbd.cnf' --- a/mysql-test/include/default_ndbd.cnf revid:mikael.ronstrom@stripped +++ b/mysql-test/include/default_ndbd.cnf revid:mikael.ronstrom@stripped @@ -1,6 +1,6 @@ [cluster_config] -ThreadConfig=ldm={count=16},tc={count=24},send={count=4},recv={count=4} +ThreadConfig=ldm={count=16},tc={count=16},send={count=4},recv={count=4} NoOfFragmentLogParts=16 MaxNoOfSavedMessages= 1000 MaxNoOfConcurrentTransactions= 2048 === modified file 'storage/ndb/include/kernel/ndb_limits.h' --- a/storage/ndb/include/kernel/ndb_limits.h revid:mikael.ronstrom@stripped +++ b/storage/ndb/include/kernel/ndb_limits.h revid:mikael.ronstrom@stripped @@ -213,14 +213,14 @@ #define MAX_THREADS_IN_BLOCK 4 #else #define NDB_MAX_LOG_PARTS 16 -#define MAX_NDBMT_TC_THREADS 24 +#define MAX_NDBMT_TC_THREADS 16 #define MAX_NDBMT_RECEIVE_THREADS 8 -#define MAX_THREADS_IN_BLOCK 24 +#define MAX_THREADS_IN_BLOCK 16 #endif #define MAX_NDBMT_LQH_WORKERS NDB_MAX_LOG_PARTS #define MAX_NDBMT_LQH_THREADS NDB_MAX_LOG_PARTS -#define MAX_NDBMT_SEND_THREADS 16 +#define MAX_NDBMT_SEND_THREADS 8 #define NDB_FILE_BUFFER_SIZE (256*1024) === modified file 'storage/ndb/src/kernel/vm/mt.cpp' --- a/storage/ndb/src/kernel/vm/mt.cpp revid:mikael.ronstrom@stripped +++ b/storage/ndb/src/kernel/vm/mt.cpp revid:mikael.ronstrom@stripped @@ -627,26 +627,23 @@ struct thr_safe_pool Uint32 i; assert(alloc_cnt > 0); - *alloced = alloc_cnt; lock(&m_lock); - if (alloc_cnt > m_cnt) + if (!m_cnt) { unlock(&m_lock); - for (i = 0; i < alloc_cnt; i++) { - ret = seize(mm, rg); - require(ret != 0 || i != 0); - if (!ret && i > 0) - { - *alloced = i; - return prev; - } - assert(ret); - ret->m_next = prev; - prev = ret; + ret = seize(mm, rg); + if (ret) + { + ret->m_next = 0; + *alloced = 1; } + else + *alloced = 0; return ret; } next = m_free_list; + alloc_cnt = alloc_cnt <= m_cnt ? alloc_cnt : m_cnt; + *alloced = alloc_cnt; for (i = 0; i < alloc_cnt; i++) { ret = next; @@ -4239,19 +4236,23 @@ Uint32 compute_jb_pages(struct EmulatorData * ed) { Uint32 cnt = get_total_number_of_block_threads(); + Uint32 num_receive_threads = globalData.ndbMtReceiveThreads; + Uint32 num_lqh_threads = globalData.ndbMtLqhThreads; + Uint32 num_tc_threads = globalData.ndbMtTcThreads; + Uint32 num_main_threads = NUM_MAIN_THREADS; Uint32 perthread = 0; /** - * Each thread can have thr_job_queue::SIZE pages in out-queues - * to each other thread + * Number of pages each thread needs to communicate with another + * thread. */ - perthread += cnt * (1 + thr_job_queue::SIZE); + Uint32 job_queue_pages_per_thread = (1 + thr_job_queue::SIZE); /** - * And thr_job_queue::SIZE prio A signals + * Each thread can have thr_job_queue::SIZE prio A signals */ - perthread += (1 + thr_job_queue::SIZE); + perthread += job_queue_pages_per_thread; /** * And XXX time-queue signals @@ -4268,6 +4269,39 @@ compute_jb_pages(struct EmulatorData * e */ Uint32 tot = cnt * perthread; + /** + * Receiver threads will be able to communicate with all other + * threads except other receive threads. + */ + tot += num_receive_threads * + (cnt - num_receive_threads) * + job_queue_pages_per_thread; + + /** + * LQH threads can communicate with TC threads and main threads. + * Cannot communicate with receive threads and other LQH threads, + * but it can communicate with itself. + */ + tot += num_lqh_threads * + (num_tc_threads * num_main_threads + 1) * + job_queue_pages_per_thread; + + /** + * TC threads can communicate with LQH threads and main threads. + * Cannot communicate with receive threads and other TC threads, + * but it can communicate with itself. + */ + tot += num_tc_threads * + (num_lqh_threads * num_main_threads + 1) * + job_queue_pages_per_thread; + + /** + * Main threads can communicate with all other threads + */ + tot += num_main_threads * + cnt * + job_queue_pages_per_thread; + return tot; } === modified file 'storage/ndb/src/kernel/vm/mt_thr_config.cpp' --- a/storage/ndb/src/kernel/vm/mt_thr_config.cpp revid:mikael.ronstrom@stripped +++ b/storage/ndb/src/kernel/vm/mt_thr_config.cpp revid:mikael.ronstrom@stripped @@ -669,15 +669,16 @@ THRConfig::do_validate() } /** - * LDM can be 1 2 4 8 16 + * LDM can be 1 2 4 8 12 16 */ if (m_threads[T_LDM].size() != 1 && m_threads[T_LDM].size() != 2 && m_threads[T_LDM].size() != 4 && m_threads[T_LDM].size() != 8 && + m_threads[T_LDM].size() != 12 && m_threads[T_LDM].size() != 16) { - m_err_msg.assfmt("No of LDM-instances can be 1,2,4,8,16. Specified: %u", + m_err_msg.assfmt("No of LDM-instances can be 1,2,4,8,12,16. Specified: %u", m_threads[T_LDM].size()); return -1; } === modified file 'storage/ndb/src/mgmsrv/ConfigInfo.cpp' --- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp revid:mikael.ronstrom@stripped +++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp revid:mikael.ronstrom@stripped @@ -4827,6 +4827,7 @@ check_2n_number_less_16(Uint32 num) case 2: case 4: case 8: + case 12: case 16: return true; default: @@ -4860,13 +4861,13 @@ checkThreadConfig(InitConfigFileParser:: if (!check_2n_number_less_16(lqhThreads)) { - ctx.reportError("NumLqhThreads must be 0, 1,2,4,8 or 16"); + ctx.reportError("NumLqhThreads must be 0, 1,2,4,8,12 or 16"); return false; } if (!check_2n_number_less_16(ndbLogParts) || ndbLogParts < 4) { - ctx.reportError("NoOfLogParts must be 4,8 or 16"); + ctx.reportError("NoOfLogParts must be 4,8,12 or 16"); return false; } if (ctx.m_currentSection->get("ThreadConfig", &thrconfig)) === modified file 'storage/ndb/test/ndbapi/flexAsynch.cpp' --- a/storage/ndb/test/ndbapi/flexAsynch.cpp revid:mikael.ronstrom@stripped +++ b/storage/ndb/test/ndbapi/flexAsynch.cpp revid:mikael.ronstrom@stripped @@ -854,7 +854,7 @@ executeTransLoop(ThreadNdb* pThread, int ops = 0; int record; Uint32 local_count = 0; - bool execute_all = false; + bool execute_all = true; DEFINE_TIMER; NdbConnection* tConArray[MAXPAR]; No bundle (reason: useless for push emails).