Add hard thread limit
The hard thread limit is now defined in maxscale/limits.h. If the specified number of threads is larger than that, it will be adjusted down. The size of the GWBITMASK is now also defined using that number, so there will always be enough bits for representing all threads.
This commit is contained in:
@ -75,6 +75,7 @@
|
||||
#include <dbusers.h>
|
||||
#include <gw.h>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/limits.h>
|
||||
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
#include <pcre2.h>
|
||||
|
||||
@ -895,8 +896,8 @@ handle_global_item(const char *name, const char *value)
|
||||
int processor_count = get_processor_count();
|
||||
if (thrcount > processor_count)
|
||||
{
|
||||
MXS_WARNING("Number of threads set to %d which is greater than"
|
||||
" the number of processors available: %d",
|
||||
MXS_WARNING("Number of threads set to %d, which is greater than "
|
||||
"the number of processors available: %d",
|
||||
thrcount, processor_count);
|
||||
}
|
||||
}
|
||||
@ -906,6 +907,14 @@ handle_global_item(const char *name, const char *value)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (gateway.n_threads > MXS_MAX_THREADS)
|
||||
{
|
||||
MXS_WARNING("Number of threads set to %d, which is greater than the "
|
||||
"hard maximum of %d. Number of threads adjusted down "
|
||||
"accordingly.", gateway.n_threads, MXS_MAX_THREADS);
|
||||
gateway.n_threads = MXS_MAX_THREADS;
|
||||
}
|
||||
}
|
||||
else if (strcmp(name, "non_blocking_polls") == 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user