bug is actually a weirdness in test system, so moving test portion into maria_notembedded.test
mysql-test/suite/maria/r/maria.result:
result update
mysql-test/suite/maria/r/maria_notembedded.result:
result update
mysql-test/suite/maria/t/maria.test:
Removing test portion into maria_notembedded.test. Explanation below.
Running maria.test with --mem --embedded --valgrind I got:
==378== Invalid read of size 4
==378== at 0x857C755: _lf_pinbox_real_free (lf_alloc-pin.c:342)
==378== by 0x857C640: _lf_pinbox_free (lf_alloc-pin.c:267)
==378== by 0x857D50C: ldelete (lf_hash.c:226)
==378== by 0x857DBC1: lf_hash_delete (lf_hash.c:429)
==378== by 0x8243D82: unlock_lock_and_free_resource
(waiting_threads.c:676)
==378== by 0x8244A79: wt_thd_release (waiting_threads.c:948)
==378== by 0x83F301D: wt_thd_release_self (trnman.c:98)
==378== by 0x83F3D49: trnman_end_trn (trnman.c:431)
==378== by 0x837C437: ma_commit (ma_commit.c:60)
==378== by 0x835F082: ha_maria::external_lock(THD*, int)
(ha_maria.cc:2387)
==378== by 0x84D1011: handler::ha_external_lock(THD*, int)
(handler.cc:4433)
==378== by 0x856DA92: unlock_external(THD*, st_table**, unsigned)
(lock.cc:786)
==378== by 0x856DD6F: mysql_unlock_tables(THD*, st_mysql_lock*)
(lock.cc:389)
==378== by 0x8274A57: close_thread_tables(THD*) (sql_base.cc:1307)
==378== by 0x82ABEC3: unlock_locked_tables(THD*) (sql_parse.cc:99)
==378== by 0x82B0BB3: mysql_execute_command(THD*)
(sql_parse.cc:3372)
==378== Address 0x5894a0c is 164 bytes inside a block of size 184
free'd
==378== at 0x40233FC: free (vg_replace_malloc.c:323)
==378== by 0x823CF92: my_thread_end (my_thr_init.c:348)
==378== by 0x8200FEE: mysql_thread_end (libmysql.c:250)
==378== by 0x81A9487: send_one_query (mysqltest.c:535)
==378== by 0x4050111: start_thread (in /lib/libpthread-2.5.so)
==378== by 0x41A52ED: clone (in /lib/libc-2.5.so)
(among other errors). The line where the invalid read happens is:
if (available_stack_size(&pinbox, *pins->stack_ends_here) >
alloca_size)
and stack_ends_here was previously set here:
el->stack_ends_here= & my_thread_var->stack_ends_here;
The mysqltest "send" command, in embedded mode, is implemented this way
(mysqltest.c:do_send_query()): a *new OS thread* is created in
mysqltest, and does this:
mysql_thread_init();
VOID(mysql_send_query(&cn->mysql, cn->cur_query,
cn->cur_query_len));
mysql_thread_end();
So, con_d "send insert t1 values (2)" creates a new OS thread, which
gets a thread-specific data (mysql_thread_init()), then sends the
query; in particular, this sets el->stack_ends_here to a pointer inside
the thread-specific data (see my_thread_var above), that is, thd->pins
depends on the thread-specific data.
This sent "insert" blocks as expected, thread-specific data is free()d
(my_thread_end() above), OS thread terminates.
Then "default" connection runs "insert t1 values (3)"
which blocks on the 3 already inserted by the con_d.
This blocking (see waiting_threads.c) creates a WT_RESOURCE, which has,
as owner, con_d's WT_THD.
When con_d calls "unlock tables" (see stack trace), it wants to release
this resource, which involves con_d's thd->pins, so it ends up reading
stack_ends_here which points inside the freed thread-specific data =>
Valgrind error, crashes...
So this is an effect of having one single connection (con_d) for which
two queries:
send insert t1 values (2)
unlock tables
are done by different OS threads. That is indeed weird design of
mysqltest, and it breaks on the dependency of lf_alloc-pin.c on
thread-specific data. It is maybe already explained in those comments
in lf_alloc-pin.c:
" It is assumed that pins belong to a THD and are not transferable
between THD's (LF_PINS::stack_ends_here being a primary reason
for this limitation)."
" It is assumed that pins belong to a thread and are not
transferable
between threads."
In correct usage of libmysqld (no two queries sent for one connection
by two threads), this problem would not happen, so I call it a
deficiency of the test system.
mysql-test/suite/maria/t/maria_notembedded.test:
moving test portion into maria_notembedded.test
Don't fsync() index file when closing Maria table if not transactional.
mysql-test/suite/maria/r/maria.result:
piece moved
mysql-test/suite/maria/r/maria_partition.result:
result
mysql-test/suite/maria/t/maria.test:
- reset default storage engine at end of test, not in the middle
- move piece which requires partitioning, to maria_partition.test, otherwise test fails
on builds without partitioning compiled in
mysql-test/suite/maria/t/maria_partition.test:
new test for those Maria bugs which are specific of partitioning
mysys/my_uuid.c:
compiler warning fix (fix imported from latest 5.1-main)
storage/maria/ma_close.c:
don't fsync() index file when closing table if not transactional
(same test as in _ma_once_end_block_record() when fsync-ing data file)
storage/maria/ma_create.c:
compiler warning fix (char* assigned to uchar*)
storage/maria/ma_loghandler.c:
compiler warning fix (char* assigned to uchar*)
- The problem was that we didn't inform the handler that we are going to close tables that are locked and may have (at least in Maria) be part of an active transaction.
Fix for Bug#39227 Maria: crash with ALTER TABLE PARTITION
Fix for Bug #39987 main.partition_not_windows fails under debug build
Fixed some compiler errors & warnings found by pushbuild
include/my_base.h:
Added HA_EXTRA_PREPARE_FOR_FORCED_CLOSE for signaling the handler that the file will be forced closed
include/my_global.h:
Removed 'register' from 'swap_variables' as this gives a warnings when the variables are structs. Compilers should also now be smart enough to figure out this themselves
mysql-test/r/subselect_debug.result:
Reset value of the debug variable; Without setting this the subselect_innodb test will fail when run after this one
mysql-test/suite/maria/r/maria.result:
Merged test with myisam.test
Added tests for new fixed bugs
mysql-test/suite/maria/t/maria.test:
Merged test with myisam.test
Added tests for new fixed bugs
mysql-test/t/subselect_debug.test:
Reset value of the debug variable; Without setting this the subselect_innodb test will fail when run after this one
mysys/my_uuid.c:
Fixed compiler error on windows
sql/ha_partition.cc:
Added support for the new extra flag: HA_EXTRA_PREPARE_FOR_FORCED_CLOSE (Bug #39226)
Ensure that we call extra() for HA_EXTRA_PREPARE_FOR_DROP (Bug#39227)
sql/mysqld.cc:
Fix for Bug #39987 main.partition_not_windows fails under debug build
The problem was that when compiling for purify/valgrind realpath() is not used, which causes test_if_data_home_dir to fail when it shouldn't
sql/sql_base.cc:
Call HA_EXTRA_PREPARE_FOR_FORCED_CLOSE for tables that are locked but we are going to force close without doing a commit
sql/sql_parse.cc:
More DBUG_PRINT. Fixed comments
storage/maria/ma_extra.c:
If HA_EXTRA_PREPARE_FOR_FORCED_CLOSE is called and the table is part of a transaction, remove the table from beeing part of a transaction.
This is safe as this is only used as part of flush tables or when the table is not part of a transaction
storage/myisam/mi_open.c:
Indentation fix
unittest/mysys/waiting_threads-t.c:
Remove not needed 'volatile' to get rid of compiler warnings on windows
mysql-test/mysql-test-run.pl:
The maria suite made default for execution.
mysql-test/suite/maria:
Maria tests moved to separate suite.
mysql-test/suite/maria/r:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-autozerofill.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-big.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-big2.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-connect.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-gis-rtree-dynamic.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-gis-rtree-trans.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-gis-rtree.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-mvcc.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-no-logging.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-page-checksum.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-preload.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-purge.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-recover.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-recovery-big.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-recovery-bitmap.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-recovery-rtree-ft.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-recovery.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria-recovery2.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria2.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria3.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/maria_notembedded.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/r/ps_maria.result:
Maria tests moved to separate suite.
mysql-test/suite/maria/t:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-autozerofill.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-big.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-big2.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-connect.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-gis-rtree-dynamic.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-gis-rtree-trans.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-gis-rtree.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-mvcc.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-no-logging.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-page-checksum.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-preload.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-purge.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-recover-master.opt:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-recover.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-recovery-big-master.opt:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-recovery-big.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-recovery-bitmap-master.opt:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-recovery-bitmap.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-recovery-master.opt:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-recovery-rtree-ft-master.opt:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-recovery-rtree-ft.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-recovery.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-recovery2-master.opt:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria-recovery2.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria2.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria3.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/maria_notembedded.test:
Maria tests moved to separate suite.
mysql-test/suite/maria/t/ps_maria.test:
Maria tests moved to separate suite.