forked from Mirrors/privacore-open-source-search-engine
Allow more than 1 thread for posdb merge adn intersection
Removed 1-thread-at-atime limit for merge and intersect threads. Made Conf::m_maxCpuThreads and Conf::m_maxCpuMergeThreads visiable and persistent.
This commit is contained in:
10
Parms.cpp
10
Parms.cpp
@ -7206,12 +7206,10 @@ void Parms::init ( ) {
|
||||
m->m_cgi = "mct";
|
||||
m->m_off = offsetof(Conf,m_maxCpuThreads);
|
||||
m->m_type = TYPE_LONG;
|
||||
// make it 3 for new gb in case one query takes way longer
|
||||
// than the others
|
||||
m->m_def = "6"; // "2";
|
||||
m->m_def = "1";
|
||||
m->m_units = "threads";
|
||||
m->m_min = 1;
|
||||
m->m_flags = PF_HIDDEN | PF_NOSAVE;
|
||||
m->m_flags = 0;
|
||||
m->m_page = PAGE_MASTER;
|
||||
m->m_obj = OBJ_CONF;
|
||||
m->m_group = false;
|
||||
@ -7223,10 +7221,10 @@ void Parms::init ( ) {
|
||||
m->m_cgi = "mcmt";
|
||||
m->m_off = offsetof(Conf,m_maxCpuMergeThreads);
|
||||
m->m_type = TYPE_LONG;
|
||||
m->m_def = "10";
|
||||
m->m_def = "1";
|
||||
m->m_units = "threads";
|
||||
m->m_min = 1;
|
||||
m->m_flags = PF_HIDDEN | PF_NOSAVE;
|
||||
m->m_flags = 0;
|
||||
m->m_page = PAGE_MASTER;
|
||||
m->m_obj = OBJ_CONF;
|
||||
m->m_group = false;
|
||||
|
17
Threads.cpp
17
Threads.cpp
@ -2078,7 +2078,10 @@ int32_t Threads::getNumActiveHighPriorityThreads() {
|
||||
bool ThreadQueue::launchThread2 ( ) {
|
||||
|
||||
// or if no stacks left, don't even try
|
||||
if ( s_head == -1 ) return false;
|
||||
if ( s_head == -1 ) {
|
||||
log("thread: ThreadQueue::launchThread2: no stacks available");
|
||||
return false;
|
||||
}
|
||||
// . how many threads are active now?
|
||||
// . NOTE: not perfectly thread safe here
|
||||
int64_t active = m_launched - m_returned ;
|
||||
@ -2087,12 +2090,20 @@ bool ThreadQueue::launchThread2 ( ) {
|
||||
log(LOG_DEBUG,"thread: q=%s launchThread: active=%"INT64" "
|
||||
"max=%"INT32".",getThreadType(), active,m_maxLaunched);
|
||||
// return if the max is already launched for this thread queue
|
||||
if ( active >= m_maxLaunched ) return false;
|
||||
if ( active >= m_maxLaunched ) {
|
||||
log("thread: ThreadQueue::launchThread2: active>m_maxLaunched (%ld>%d)", active, m_maxLaunched);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ( m_threadType != DISK_THREAD ) {
|
||||
// if one thread of this type is already out, forget it
|
||||
if ( m_launchedHead ) return false;
|
||||
if ( m_threadType!=MERGE_THREAD &&
|
||||
m_threadType!=INTERSECT_THREAD &&
|
||||
m_launchedHead ) {
|
||||
log("@@@@ ThreadQueue::launchThread2: already one of that tpe");
|
||||
return false;
|
||||
}
|
||||
// first try niceness 0 queue
|
||||
ThreadEntry **bestHeadPtr = &m_waitHead0;
|
||||
ThreadEntry **bestTailPtr = &m_waitTail0;
|
||||
|
Reference in New Issue
Block a user