From 6388a13230af3b9cfb59287a947f32b977d2538e Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 11 Nov 2009 00:55:05 +0400 Subject: [PATCH 1/4] Bug#42520 killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8 The additional patch. That 'loadxml.test' failure was actually about our testing system, not the code. Firstly we need a new mysqltest command, wich i called 'send_eval'. So the expression can be evaluated, then started in a parallel thread. We only have separane 'send' and 'eval' commands at the moment. Then we need to add the waiting code after the 'KILL' to our test, so the thread will be killed before the test goes further. The present 'reap' command doesn't handle the killed threads well. per-file comments: client/mysqltest.cc Bug#42520 killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8 The 'send_eval' command implemented. mysql-test/r/loadxml.result Bug#42520 killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8 test result updated. mysql-test/t/loadxml.test Bug#42520 killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8 test case added. --- client/mysqltest.cc | 6 ++++-- mysql-test/r/loadxml.result | 4 ++-- mysql-test/t/loadxml.test | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index a20e078230b..4f42077a2f9 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -281,7 +281,7 @@ enum enum_commands { Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR, Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE, Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER, - Q_MOVE_FILE, + Q_MOVE_FILE, Q_SEND_EVAL, Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ @@ -376,6 +376,7 @@ const char *command_names[]= "send_shutdown", "shutdown_server", "move_file", + "send_eval", 0 }; @@ -7006,7 +7007,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) /* Evaluate query if this is an eval command */ - if (command->type == Q_EVAL) + if (command->type == Q_EVAL || command->type == Q_SEND_EVAL) { init_dynamic_string(&eval_query, "", command->query_len+256, 1024); do_eval(&eval_query, command->query, command->end, FALSE); @@ -7825,6 +7826,7 @@ int main(int argc, char **argv) break; } case Q_SEND: + case Q_SEND_EVAL: if (!*command->first_argument) { /* diff --git a/mysql-test/r/loadxml.result b/mysql-test/r/loadxml.result index d7967a105f8..25bc82a0a2e 100644 --- a/mysql-test/r/loadxml.result +++ b/mysql-test/r/loadxml.result @@ -58,11 +58,11 @@ select 1 as xml; xml 1 create table t2(fl text); -LOAD XML LOCAL INFILE "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '';; +LOAD XML LOCAL INFILE "MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '';; show processlist; Id User Host db Command Time State Info # root localhost test Query # NULL show processlist -# root localhost test Query # Reading from net LOAD XML LOCAL INFILE "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '

'; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--send_eval LOAD XML LOCAL INFILE "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY ''; sleep 3; connection default; +sleep 1; --replace_column 1 # 3 localhost 6 # show processlist; --disable_query_log --eval kill $PSEUDO_THREAD_ID +sleep 2; --enable_query_log disconnect addconroot; From c868e89f82ffbaa2ec624e39294a48867da392c8 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 11 Nov 2009 01:10:30 +0400 Subject: [PATCH 2/4] Bug #47139 Test "merge" crashes in "embedded" run In fact this crashes in normal (not embedded) run also. The problem is in the memory mapping. Handling the ha_myisammrg::extra(MMAP) the MERGE engine tries to mmap all the tables it unites. Though some can be empty and then in the mi_dynmap_file() we call the my_mmap(0). Normally this call returns MAP_FAILED, but not on FreeBSD. There it returns like a 'normal' value, and after the consequitive munmap systems gets unstable and crashes on some system call later. per-file comments: storage/myisam/mi_dynrec.c Bug #47139 Test "merge" crashes in "embedded" run don't try to mmap zero-length area, just return at once. --- storage/myisam/mi_dynrec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 696b9ff93df..79f1ea0e4e5 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -66,9 +66,12 @@ static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos, my_bool mi_dynmap_file(MI_INFO *info, my_off_t size) { DBUG_ENTER("mi_dynmap_file"); - if (size > (my_off_t) (~((size_t) 0))) + if (size == 0 || size > (my_off_t) (~((size_t) 0))) { - DBUG_PRINT("warning", ("File is too large for mmap")); + if (size) + DBUG_PRINT("warning", ("File is too large for mmap")); + else + DBUG_PRINT("warning", ("Do not mmap zero-length")); DBUG_RETURN(1); } /* From 134d2fb675a5b7b1f98c4b8d4a0d07a9095332b7 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 11 Nov 2009 05:42:02 +0400 Subject: [PATCH 3/4] loadxml test update. --- mysql-test/r/loadxml.result | 2 +- mysql-test/t/loadxml.test | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/loadxml.result b/mysql-test/r/loadxml.result index 25bc82a0a2e..e7a32aa368a 100644 --- a/mysql-test/r/loadxml.result +++ b/mysql-test/r/loadxml.result @@ -62,7 +62,7 @@ LOAD XML LOCAL INFILE "MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROW show processlist; Id User Host db Command Time State Info # root localhost test Query # NULL show processlist -# root localhost test Query # Reading from net LOAD XML LOCAL INFILE "/home/hf/work/mysql_common/51alik/mysql-test/var/tmp/loadxml-dump.xml" INTO +# root localhost test Query # Reading from net LOAD XML LOCAL INFILE "MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO drop table t1; drop table t2; create table t1 ( diff --git a/mysql-test/t/loadxml.test b/mysql-test/t/loadxml.test index e3e4bbbee19..396fba6a6f2 100644 --- a/mysql-test/t/loadxml.test +++ b/mysql-test/t/loadxml.test @@ -79,6 +79,7 @@ sleep 3; connection default; sleep 1; --replace_column 1 # 3 localhost 6 # +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR show processlist; --disable_query_log From 5e85d7170a1946e496d1c29dde55fabfc507c913 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 11 Nov 2009 21:30:51 +0400 Subject: [PATCH 4/4] test updated --- mysql-test/r/loadxml.result | 4 ---- mysql-test/t/loadxml.test | 3 --- 2 files changed, 7 deletions(-) diff --git a/mysql-test/r/loadxml.result b/mysql-test/r/loadxml.result index e7a32aa368a..55e6759748a 100644 --- a/mysql-test/r/loadxml.result +++ b/mysql-test/r/loadxml.result @@ -59,10 +59,6 @@ xml 1 create table t2(fl text); LOAD XML LOCAL INFILE "MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '';; -show processlist; -Id User Host db Command Time State Info -# root localhost test Query # NULL show processlist -# root localhost test Query # Reading from net LOAD XML LOCAL INFILE "MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO drop table t1; drop table t2; create table t1 ( diff --git a/mysql-test/t/loadxml.test b/mysql-test/t/loadxml.test index 396fba6a6f2..8b9c1bd1b0d 100644 --- a/mysql-test/t/loadxml.test +++ b/mysql-test/t/loadxml.test @@ -78,9 +78,6 @@ sleep 3; connection default; sleep 1; ---replace_column 1 # 3 localhost 6 # ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -show processlist; --disable_query_log --eval kill $PSEUDO_THREAD_ID