Merge branch '2.3' into develop
This commit is contained in:
@ -25,6 +25,15 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/etc/maxscale.conf.in ${CMAKE_BINARY_DIR}/maxscale.conf @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/etc/maxscale.conf.in ${CMAKE_BINARY_DIR}/maxscale.conf @ONLY)
|
||||||
|
|
||||||
|
# The systemd service file
|
||||||
|
if (CMAKE_BUILD_TYPE MATCHES "(D|d)(E|e)(B|b)(U|u)(G|g)")
|
||||||
|
# Options enabled only in debug builds (a literal multi-line string)
|
||||||
|
set(SERVICE_FILE_DEBUG_OPTIONS
|
||||||
|
"LimitCORE=infinity
|
||||||
|
ExecStartPost=/bin/sh -c 'prlimit -p $(pidof maxscale) --core=unlimited'")
|
||||||
|
endif()
|
||||||
|
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/etc/maxscale.service.in ${CMAKE_BINARY_DIR}/maxscale.service @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/etc/maxscale.service.in ${CMAKE_BINARY_DIR}/maxscale.service @ONLY)
|
||||||
|
|
||||||
if(PACKAGE)
|
if(PACKAGE)
|
||||||
|
@ -5,6 +5,7 @@ After=network.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
Restart=on-abort
|
Restart=on-abort
|
||||||
|
@SERVICE_FILE_DEBUG_OPTIONS@
|
||||||
|
|
||||||
# Make sure /var/run/maxscale exists
|
# Make sure /var/run/maxscale exists
|
||||||
PermissionsStartOnly=true
|
PermissionsStartOnly=true
|
||||||
|
@ -420,7 +420,7 @@ public:
|
|||||||
static MXS_ROUTER_SESSION* newSession(MXS_ROUTER* pInstance, MXS_SESSION* pSession)
|
static MXS_ROUTER_SESSION* newSession(MXS_ROUTER* pInstance, MXS_SESSION* pSession)
|
||||||
{
|
{
|
||||||
RouterType* pRouter = static_cast<RouterType*>(pInstance);
|
RouterType* pRouter = static_cast<RouterType*>(pInstance);
|
||||||
RouterSessionType* pRouter_session;
|
RouterSessionType* pRouter_session = nullptr;
|
||||||
|
|
||||||
MXS_EXCEPTION_GUARD(pRouter_session = pRouter->newSession(pSession));
|
MXS_EXCEPTION_GUARD(pRouter_session = pRouter->newSession(pSession));
|
||||||
|
|
||||||
|
@ -3362,7 +3362,7 @@ extern "C"
|
|||||||
// 'unsigned int' and not 'uint32_t' because 'uint32_t' is unknown in sqlite3 context.
|
// 'unsigned int' and not 'uint32_t' because 'uint32_t' is unknown in sqlite3 context.
|
||||||
extern void maxscale_set_type_mask(unsigned int type_mask);
|
extern void maxscale_set_type_mask(unsigned int type_mask);
|
||||||
|
|
||||||
extern void maxscaleComment();
|
extern int maxscaleComment();
|
||||||
extern int maxscaleKeyword(int token);
|
extern int maxscaleKeyword(int token);
|
||||||
extern int maxscaleTranslateKeyword(int token);
|
extern int maxscaleTranslateKeyword(int token);
|
||||||
}
|
}
|
||||||
@ -4190,14 +4190,18 @@ void maxscaleCreateSequence(Parse* pParse, Token* pDatabase, Token* pTable)
|
|||||||
QC_EXCEPTION_GUARD(pInfo->maxscaleCreateSequence(pParse, pDatabase, pTable));
|
QC_EXCEPTION_GUARD(pInfo->maxscaleCreateSequence(pParse, pDatabase, pTable));
|
||||||
}
|
}
|
||||||
|
|
||||||
void maxscaleComment()
|
int maxscaleComment()
|
||||||
{
|
{
|
||||||
QC_TRACE();
|
QC_TRACE();
|
||||||
|
|
||||||
QcSqliteInfo* pInfo = this_thread.pInfo;
|
QcSqliteInfo* pInfo = this_thread.pInfo;
|
||||||
mxb_assert(pInfo);
|
mxb_assert(pInfo);
|
||||||
|
|
||||||
QC_EXCEPTION_GUARD(pInfo->maxscaleComment());
|
int rc = 0;
|
||||||
|
|
||||||
|
QC_EXCEPTION_GUARD(rc = pInfo->maxscaleComment());
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void maxscaleDeclare(Parse* pParse)
|
void maxscaleDeclare(Parse* pParse)
|
||||||
|
@ -17,24 +17,26 @@ if (BUILD_QC_MYSQLEMBEDDED)
|
|||||||
file(COPY ${ERRMSG} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
file(COPY ${ERRMSG} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(classify classify.cc)
|
add_executable(classify classify.cc)
|
||||||
target_link_libraries(classify maxscale-common)
|
target_link_libraries(classify maxscale-common)
|
||||||
|
|
||||||
add_executable(compare compare.cc testreader.cc)
|
add_executable(compare compare.cc testreader.cc)
|
||||||
target_link_libraries(compare maxscale-common)
|
target_link_libraries(compare maxscale-common)
|
||||||
|
|
||||||
add_executable(qc_cache qc_cache.cc)
|
add_executable(qc_cache qc_cache.cc)
|
||||||
target_link_libraries(qc_cache maxscale-common)
|
target_link_libraries(qc_cache maxscale-common)
|
||||||
|
|
||||||
add_executable(version_sensitivity version_sensitivity.cc)
|
add_executable(version_sensitivity version_sensitivity.cc)
|
||||||
target_link_libraries(version_sensitivity maxscale-common)
|
target_link_libraries(version_sensitivity maxscale-common)
|
||||||
|
|
||||||
add_executable(crash_qc_sqlite crash_qc_sqlite.cc)
|
add_executable(crash_qc_sqlite crash_qc_sqlite.cc)
|
||||||
target_link_libraries(crash_qc_sqlite maxscale-common)
|
target_link_libraries(crash_qc_sqlite maxscale-common)
|
||||||
|
|
||||||
add_test(TestQC_Crash_qcsqlite crash_qc_sqlite)
|
add_test(TestQC_Crash_qcsqlite crash_qc_sqlite)
|
||||||
|
|
||||||
|
if (BUILD_QC_MYSQLEMBEDDED)
|
||||||
# TestQC_MySQLEmbedded excluded, classify is now solely used for verifying the
|
# TestQC_MySQLEmbedded excluded, classify is now solely used for verifying the
|
||||||
# functionality of qc_sqlite.
|
# functionality of qc_sqlite.
|
||||||
#add_test(TestQC_MySQLEmbedded classify qc_mysqlembedded ${CMAKE_CURRENT_SOURCE_DIR}/input.sql ${CMAKE_CURRENT_SOURCE_DIR}/expected.sql)
|
#add_test(TestQC_MySQLEmbedded classify qc_mysqlembedded ${CMAKE_CURRENT_SOURCE_DIR}/input.sql ${CMAKE_CURRENT_SOURCE_DIR}/expected.sql)
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <my_config.h>
|
|
||||||
#include <maxscale/paths.h>
|
#include <maxscale/paths.h>
|
||||||
#include <maxscale/log.hh>
|
#include <maxscale/log.hh>
|
||||||
#include <maxscale/protocol/mysql.hh>
|
#include <maxscale/protocol/mysql.hh>
|
||||||
@ -48,10 +47,11 @@ namespace
|
|||||||
{
|
{
|
||||||
|
|
||||||
char USAGE[] =
|
char USAGE[] =
|
||||||
"usage: compare [-r count] [-d] [-1 classfier1] [-2 classifier2] "
|
"usage: compare [-r count] [-d] [-0 classifier] [-1 classfier1] [-2 classifier2] "
|
||||||
"[-A args] [-B args] [-C args] [-m [default|oracle]] [-v [0..2]] [-s statement]|[file]]\n\n"
|
"[-A args] [-B args] [-C args] [-m [default|oracle]] [-v [0..2]] [-s statement]|[file]]\n\n"
|
||||||
"-r redo the test the specified number of times; 0 means forever, default is 1\n"
|
"-r redo the test the specified number of times; 0 means forever, default is 1\n"
|
||||||
"-d don't stop after first failed query\n"
|
"-d don't stop after first failed query\n"
|
||||||
|
"-0 sanity check mode, compares the statement twice with the same classifier\n"
|
||||||
"-1 the first classifier, default 'qc_mysqlembedded'\n"
|
"-1 the first classifier, default 'qc_mysqlembedded'\n"
|
||||||
"-2 the second classifier, default 'qc_sqlite'\n"
|
"-2 the second classifier, default 'qc_sqlite'\n"
|
||||||
"-A arguments for the first classifier\n"
|
"-A arguments for the first classifier\n"
|
||||||
@ -172,17 +172,22 @@ QUERY_CLASSIFIER* load_classifier(const char* name)
|
|||||||
|
|
||||||
QUERY_CLASSIFIER* get_classifier(const char* zName, qc_sql_mode_t sql_mode, const char* zArgs)
|
QUERY_CLASSIFIER* get_classifier(const char* zName, qc_sql_mode_t sql_mode, const char* zArgs)
|
||||||
{
|
{
|
||||||
QUERY_CLASSIFIER* pClassifier = load_classifier(zName);
|
QUERY_CLASSIFIER* pClassifier = nullptr;
|
||||||
|
|
||||||
if (pClassifier)
|
if (zName)
|
||||||
{
|
{
|
||||||
if (pClassifier->qc_setup(sql_mode, zArgs) != QC_RESULT_OK
|
pClassifier = load_classifier(zName);
|
||||||
|| pClassifier->qc_process_init() != QC_RESULT_OK
|
|
||||||
|| pClassifier->qc_thread_init() != QC_RESULT_OK)
|
if (pClassifier)
|
||||||
{
|
{
|
||||||
cerr << "error: Could not setup or init classifier " << zName << "." << endl;
|
if (pClassifier->qc_setup(sql_mode, zArgs) != QC_RESULT_OK
|
||||||
qc_unload(pClassifier);
|
|| pClassifier->qc_process_init() != QC_RESULT_OK
|
||||||
pClassifier = 0;
|
|| pClassifier->qc_thread_init() != QC_RESULT_OK)
|
||||||
|
{
|
||||||
|
cerr << "error: Could not setup or init classifier " << zName << "." << endl;
|
||||||
|
qc_unload(pClassifier);
|
||||||
|
pClassifier = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,21 +214,18 @@ bool get_classifiers(qc_sql_mode_t sql_mode,
|
|||||||
bool rc = false;
|
bool rc = false;
|
||||||
|
|
||||||
QUERY_CLASSIFIER* pClassifier1 = get_classifier(zName1, sql_mode, zArgs1);
|
QUERY_CLASSIFIER* pClassifier1 = get_classifier(zName1, sql_mode, zArgs1);
|
||||||
|
QUERY_CLASSIFIER* pClassifier2 = get_classifier(zName2, sql_mode, zArgs2);
|
||||||
|
|
||||||
if (pClassifier1)
|
if ((!zName1 || pClassifier1) && (!zName2 || pClassifier2))
|
||||||
{
|
{
|
||||||
QUERY_CLASSIFIER* pClassifier2 = get_classifier(zName2, sql_mode, zArgs2);
|
*ppClassifier1 = pClassifier1;
|
||||||
|
*ppClassifier2 = pClassifier2;
|
||||||
if (pClassifier2)
|
rc = true;
|
||||||
{
|
}
|
||||||
*ppClassifier1 = pClassifier1;
|
else
|
||||||
*ppClassifier2 = pClassifier2;
|
{
|
||||||
rc = true;
|
put_classifier(pClassifier1);
|
||||||
}
|
put_classifier(pClassifier2);
|
||||||
else
|
|
||||||
{
|
|
||||||
put_classifier(pClassifier1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@ -1494,11 +1496,12 @@ int main(int argc, char* argv[])
|
|||||||
#endif
|
#endif
|
||||||
const char* zStatement = NULL;
|
const char* zStatement = NULL;
|
||||||
qc_sql_mode_t sql_mode = QC_SQL_MODE_DEFAULT;
|
qc_sql_mode_t sql_mode = QC_SQL_MODE_DEFAULT;
|
||||||
|
bool solo = false;
|
||||||
|
|
||||||
size_t rounds = 1;
|
size_t rounds = 1;
|
||||||
int v = VERBOSITY_NORMAL;
|
int v = VERBOSITY_NORMAL;
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "r:d1:2:v:A:B:C:m:s:SR")) != -1)
|
while ((c = getopt(argc, argv, "r:d0:1:2:v:A:B:C:m:s:SR")) != -1)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
@ -1510,6 +1513,12 @@ int main(int argc, char* argv[])
|
|||||||
v = atoi(optarg);
|
v = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case '0':
|
||||||
|
zClassifier1 = optarg;
|
||||||
|
zClassifier2 = nullptr;
|
||||||
|
solo = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case '1':
|
case '1':
|
||||||
zClassifier1 = optarg;
|
zClassifier1 = optarg;
|
||||||
break;
|
break;
|
||||||
@ -1601,6 +1610,11 @@ int main(int argc, char* argv[])
|
|||||||
size_t round = 0;
|
size_t round = 0;
|
||||||
bool terminate = false;
|
bool terminate = false;
|
||||||
|
|
||||||
|
if (solo)
|
||||||
|
{
|
||||||
|
pClassifier2 = pClassifier1;
|
||||||
|
}
|
||||||
|
|
||||||
pClassifier1->qc_set_server_version(version);
|
pClassifier1->qc_set_server_version(version);
|
||||||
pClassifier2->qc_set_server_version(version);
|
pClassifier2->qc_set_server_version(version);
|
||||||
|
|
||||||
@ -1649,6 +1663,11 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
while (!terminate && ((rounds == 0) || (round < rounds)));
|
while (!terminate && ((rounds == 0) || (round < rounds)));
|
||||||
|
|
||||||
|
if (solo)
|
||||||
|
{
|
||||||
|
pClassifier2 = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
put_classifiers(pClassifier1, pClassifier2);
|
put_classifiers(pClassifier1, pClassifier2);
|
||||||
|
|
||||||
cout << "\n";
|
cout << "\n";
|
||||||
|
@ -122,7 +122,7 @@ int test(StorageFactory& factory, istream& in)
|
|||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int rv = EXIT_FAILURE;
|
int rv = EXIT_FAILURE;
|
||||||
StorageFactory* pFactory;
|
StorageFactory* pFactory = nullptr;
|
||||||
if ((argc == 2) || (argc == 3))
|
if ((argc == 2) || (argc == 3))
|
||||||
{
|
{
|
||||||
char* libdir = MXS_STRDUP("../../../../../query_classifier/qc_sqlite/");
|
char* libdir = MXS_STRDUP("../../../../../query_classifier/qc_sqlite/");
|
||||||
|
@ -130,7 +130,9 @@ HINT* hint_parser(HINT_SESSION* session, GWBUF* request)
|
|||||||
int len, residual, state;
|
int len, residual, state;
|
||||||
int found, escape, quoted, squoted;
|
int found, escape, quoted, squoted;
|
||||||
HINT* rval = NULL;
|
HINT* rval = NULL;
|
||||||
char* pname, * lvalue, * hintname = NULL;
|
char* pname = nullptr;
|
||||||
|
char* lvalue = nullptr;
|
||||||
|
char* hintname = nullptr;
|
||||||
GWBUF* buf;
|
GWBUF* buf;
|
||||||
HINT_TOKEN* tok;
|
HINT_TOKEN* tok;
|
||||||
HINT_MODE mode = HM_EXECUTE;
|
HINT_MODE mode = HM_EXECUTE;
|
||||||
|
@ -739,7 +739,7 @@ static void destroyInstance(MXS_FILTER* instance)
|
|||||||
|
|
||||||
static void checkNamedPipe(TPM_INSTANCE* inst)
|
static void checkNamedPipe(TPM_INSTANCE* inst)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = 0;
|
||||||
char buffer[2];
|
char buffer[2];
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
char* named_pipe = inst->named_pipe;
|
char* named_pipe = inst->named_pipe;
|
||||||
|
@ -487,7 +487,7 @@ private:
|
|||||||
{
|
{
|
||||||
result_t rv = IS_SET_SQL_MODE;
|
result_t rv = IS_SET_SQL_MODE;
|
||||||
|
|
||||||
char c;
|
char c = *pSql_mode;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,8 @@ bool json_extract_field_names(const char* filename, std::vector<Column>& columns
|
|||||||
bool rval = false;
|
bool rval = false;
|
||||||
json_error_t err;
|
json_error_t err;
|
||||||
err.text[0] = '\0';
|
err.text[0] = '\0';
|
||||||
json_t* obj, * arr;
|
json_t* obj;
|
||||||
|
json_t* arr = nullptr;
|
||||||
|
|
||||||
if ((obj = json_load_file(filename, 0, &err)) && (arr = json_object_get(obj, "fields")))
|
if ((obj = json_load_file(filename, 0, &err)) && (arr = json_object_get(obj, "fields")))
|
||||||
{
|
{
|
||||||
|
@ -3063,17 +3063,17 @@ void blr_handle_fake_gtid_list(ROUTER_INSTANCE* router,
|
|||||||
static bool blr_handle_missing_files(ROUTER_INSTANCE* router,
|
static bool blr_handle_missing_files(ROUTER_INSTANCE* router,
|
||||||
char* new_file)
|
char* new_file)
|
||||||
{
|
{
|
||||||
char* fptr;
|
char* fptr = strrchr(new_file, '.');
|
||||||
uint32_t new_fseqno;
|
uint32_t new_fseqno;
|
||||||
uint32_t curr_fseqno;
|
uint32_t curr_fseqno;
|
||||||
char buf[BLRM_BINLOG_NAME_STR_LEN];
|
char buf[BLRM_BINLOG_NAME_STR_LEN];
|
||||||
char bigbuf[PATH_MAX + 1];
|
char bigbuf[PATH_MAX + 1];
|
||||||
|
|
||||||
if (*new_file
|
if (fptr == NULL)
|
||||||
&& (fptr = strrchr(new_file, '.')) == NULL)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (router->fileroot)
|
if (router->fileroot)
|
||||||
{
|
{
|
||||||
MXS_FREE(router->fileroot);
|
MXS_FREE(router->fileroot);
|
||||||
|
Reference in New Issue
Block a user