MXS-1633 Turn off collecting of sqlite3 memstats
According to customer reports collecting the statistics has a significant impact on the performance. As we don't need that information we can just as well turn off that. Further, since maxscale-common now links to the sqlite3-library, no module needs to do that explicitly.
This commit is contained in:
parent
5bc945df3f
commit
6410b4f19a
@ -73,6 +73,7 @@ target_link_libraries(maxscale-common
|
||||
z
|
||||
rt
|
||||
m
|
||||
sqlite3
|
||||
stdc++
|
||||
gnutls
|
||||
gcrypt
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <maxscale/paths.h>
|
||||
#include <maxscale/query_classifier.h>
|
||||
#include <maxscale/server.h>
|
||||
#include <maxscale/sqlite3.h>
|
||||
#include <maxscale/session.h>
|
||||
#include <maxscale/utils.h>
|
||||
#include <maxscale/version.h>
|
||||
@ -189,6 +190,7 @@ static void disable_module_unloading(const char* arg);
|
||||
static void enable_module_unloading(const char* arg);
|
||||
static void redirect_output_to_file(const char* arg);
|
||||
static bool user_is_acceptable(const char* specified_user);
|
||||
static bool init_sqlite3();
|
||||
|
||||
struct DEBUG_ARGUMENT
|
||||
{
|
||||
@ -1957,6 +1959,13 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (!init_sqlite3())
|
||||
{
|
||||
MXS_ERROR("Could not initialize sqlite3, exiting.");
|
||||
rc = MAXSCALE_INTERNALERROR;
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
MXS_NOTICE("MariaDB MaxScale %s started", MAXSCALE_VERSION);
|
||||
MXS_NOTICE("MaxScale is running in process %i", getpid());
|
||||
|
||||
@ -3304,3 +3313,33 @@ static bool user_is_acceptable(const char* specified_user)
|
||||
|
||||
return acceptable;
|
||||
}
|
||||
|
||||
static bool init_sqlite3()
|
||||
{
|
||||
bool rv = true;
|
||||
|
||||
// Collecting the memstatus introduces locking that, according to customer reports,
|
||||
// has a significant impact on the performance.
|
||||
if (sqlite3_config(SQLITE_CONFIG_MEMSTATUS, (int)0) == SQLITE_OK) // 0 turns off.
|
||||
{
|
||||
MXS_NOTICE("The collection of SQLite memory allocation statistics turned off.");
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_WARNING("Could not turn off the collection of SQLite memory allocation statistics.");
|
||||
// Non-fatal, we simply will take a small performance hit.
|
||||
}
|
||||
|
||||
if (sqlite3_config(SQLITE_CONFIG_MULTITHREAD) == SQLITE_OK)
|
||||
{
|
||||
MXS_NOTICE("Threading mode of SQLite set to Multi-thread.");
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Could not set the threading mode of SQLite to Multi-thread. "
|
||||
"MaxScale will terminate.");
|
||||
rv = false;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ if(SQLITE_VERSION VERSION_LESS 3.3)
|
||||
message(FATAL_ERROR "SQLite version 3.3 or higher is required")
|
||||
else()
|
||||
add_library(mysqlauth SHARED mysql_auth.c dbusers.c)
|
||||
target_link_libraries(mysqlauth maxscale-common mysqlcommon sqlite3)
|
||||
target_link_libraries(mysqlauth maxscale-common mysqlcommon)
|
||||
set_target_properties(mysqlauth PROPERTIES VERSION "1.0.0")
|
||||
install_module(mysqlauth core)
|
||||
endif()
|
||||
|
@ -4,7 +4,7 @@ if(AVRO_FOUND AND JANSSON_FOUND)
|
||||
add_library(avrorouter SHARED avro.c ../binlogrouter/binlog_common.c avro_client.c avro_schema.c avro_rbr.c avro_file.c avro_index.c)
|
||||
set_target_properties(avrorouter PROPERTIES VERSION "1.0.0")
|
||||
set_target_properties(avrorouter PROPERTIES LINK_FLAGS -Wl,-z,defs)
|
||||
target_link_libraries(avrorouter maxscale-common ${JANSSON_LIBRARIES} ${AVRO_LIBRARIES} maxavro sqlite3 lzma)
|
||||
target_link_libraries(avrorouter maxscale-common ${JANSSON_LIBRARIES} ${AVRO_LIBRARIES} maxavro lzma)
|
||||
install_module(avrorouter core)
|
||||
else()
|
||||
message(STATUS "No Avro C or Jansson libraries found, not building avrorouter.")
|
||||
|
@ -1,11 +1,11 @@
|
||||
add_library(binlogrouter SHARED blr.c blr_master.c blr_cache.c blr_slave.c blr_file.c)
|
||||
set_target_properties(binlogrouter PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${MAXSCALE_LIBDIR} VERSION "2.0.0")
|
||||
set_target_properties(binlogrouter PROPERTIES LINK_FLAGS -Wl,-z,defs)
|
||||
target_link_libraries(binlogrouter maxscale-common ${PCRE_LINK_FLAGS} uuid sqlite3)
|
||||
target_link_libraries(binlogrouter maxscale-common ${PCRE_LINK_FLAGS} uuid)
|
||||
install_module(binlogrouter core)
|
||||
|
||||
add_executable(maxbinlogcheck maxbinlogcheck.c blr_file.c blr_cache.c blr_master.c blr_slave.c blr.c)
|
||||
target_link_libraries(maxbinlogcheck maxscale-common ${PCRE_LINK_FLAGS} uuid sqlite3)
|
||||
target_link_libraries(maxbinlogcheck maxscale-common ${PCRE_LINK_FLAGS} uuid)
|
||||
|
||||
install_executable(maxbinlogcheck core)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
if(BUILD_TESTS)
|
||||
add_executable(testbinlogrouter testbinlog.c ../blr.c ../blr_slave.c ../blr_master.c ../blr_file.c ../blr_cache.c)
|
||||
target_link_libraries(testbinlogrouter maxscale-common ${PCRE_LINK_FLAGS} uuid sqlite3)
|
||||
target_link_libraries(testbinlogrouter maxscale-common ${PCRE_LINK_FLAGS} uuid)
|
||||
add_test(NAME TestBinlogRouter COMMAND ./testbinlogrouter WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user