From c5fbb1f29594adbc403e2d09feec8cd4c1e880be Mon Sep 17 00:00:00 2001 From: VilhoRaatikka Date: Mon, 25 Aug 2014 22:17:21 +0300 Subject: [PATCH] query_classifier.cc:parsing_info_done: calling mysql_thread_end caused segfauls when same thread tried next time call free_embedded_thd because thread's sysvar was set to NULL in mysql_thread_end. Added a few lines to canonical query test's input script which are not handled correctly. --- log_manager/test/makefile | 2 +- query_classifier/query_classifier.cc | 4 +--- query_classifier/test/canonical_tests/input.sql | 4 ++++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/log_manager/test/makefile b/log_manager/test/makefile index 75df90c60..71fd074f1 100644 --- a/log_manager/test/makefile +++ b/log_manager/test/makefile @@ -39,7 +39,7 @@ buildtests: -o testlog \ -I$(MARIADB_SRC_PATH)/include \ -I$(LOG_MANAGER_PATH) -I$(UTILS_PATH) testlog.c \ - -llog_manager $(LDLIBS) \ + -lstdc++ -llog_manager $(LDLIBS) \ $(UTILS_PATH)/skygw_utils.o diff --git a/query_classifier/query_classifier.cc b/query_classifier/query_classifier.cc index 009cbe94f..8cef07a10 100644 --- a/query_classifier/query_classifier.cc +++ b/query_classifier/query_classifier.cc @@ -964,9 +964,8 @@ parsing_info_t* parsing_info_init( mysql_errno(mysql), mysql_error(mysql)))); - mysql_library_end(); goto retblock; - } + } /** Set methods and authentication to mysql */ mysql_options(mysql, MYSQL_READ_DEFAULT_GROUP, "libmysqld_skygw"); mysql_options(mysql, MYSQL_OPT_USE_EMBEDDED_CONNECTION, NULL); @@ -1019,7 +1018,6 @@ void parsing_info_done( mysql->thd = NULL; } mysql_close(mysql); - mysql_thread_end(); } /** Free plain text query string */ if (pi->pi_query_plain_str != NULL) diff --git a/query_classifier/test/canonical_tests/input.sql b/query_classifier/test/canonical_tests/input.sql index eabf0af32..5e0410761 100755 --- a/query_classifier/test/canonical_tests/input.sql +++ b/query_classifier/test/canonical_tests/input.sql @@ -4,3 +4,7 @@ select 1,2,3,4,5,6 from tst; select * from tst where fname like '%a%'; select * from tst where lname like '%e%' order by fname; insert into tst values ("John","Doe"),("Plato",null),("Nietzsche",""); +select md5("200000foo") =10, sleep(2), rand(100); +select * from my1 where md5("110") =10; +select md5("100foo") =10; +select * from my1 where md5("100") =10;