mirror of
https://github.com/MariaDB/server.git
synced 2025-09-08 06:27:57 +03:00
client/mysqltest.cc: Free mutex after usage (fixes valgrind warnings in embedded server) mysql-test/include/gis_keys.inc: Fixed failure in innodb.gis_test mysql-test/r/gis.result: Updated result mysql-test/suite/innodb/r/innodb_gis.result: Updated results mysql-test/suite/innodb/t/innodb_bug38231.test: Added handling of timeouts (happend on some servers in buildbot) mysql-test/suite/innodb_plugin/r/innodb_gis.result: Updated results mysql-test/suite/innodb_plugin/t/innodb.test: Use error names instead of numbers mysql-test/suite/innodb_plugin/t/innodb_misc1.test: This test requires utf8 mysql-test/suite/innodb_plugin/t/innodb_mysql.test: This test requires Xtradb sql/sql_base.cc: Don't print table names for placeholders. sql/sql_show.cc: Temporary fix: Save and restore db and table_name in mysqld_show_create (to get rid of valgrind warning) A better solution that needs to be investgated is to not change these fields in mysql_derived_prepare() sql/sql_view.cc: Fixed valgrind warning storage/xtradb/handler/ha_innodb.cc: Don't access THD directly
119 lines
2.9 KiB
Plaintext
119 lines
2.9 KiB
Plaintext
#
|
|
# Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK
|
|
# http://bugs.mysql.com/38231
|
|
#
|
|
|
|
-- source include/have_innodb.inc
|
|
|
|
SET storage_engine=InnoDB;
|
|
|
|
# we care only that the following SQL commands do not crash the server
|
|
-- disable_query_log
|
|
-- disable_result_log
|
|
|
|
DROP TABLE IF EXISTS bug38231;
|
|
CREATE TABLE bug38231 (a INT);
|
|
|
|
-- connect (con1,localhost,root,,)
|
|
-- connect (con2,localhost,root,,)
|
|
-- connect (con3,localhost,root,,)
|
|
|
|
-- connection con1
|
|
SET autocommit=0;
|
|
LOCK TABLE bug38231 WRITE;
|
|
|
|
-- connection con2
|
|
SET autocommit=0;
|
|
-- send
|
|
LOCK TABLE bug38231 WRITE;
|
|
|
|
# When con1 does UNLOCK below this will release either con2 or con3 which are
|
|
# both waiting on LOCK. At the end we must first --reap and UNLOCK the
|
|
# connection that has been released, otherwise it will wait forever. We assume
|
|
# that the released connection will be the first one that has gained the LOCK,
|
|
# thus we force the order here - con2 does LOCK first, then con3. In other
|
|
# words we wait for LOCK from con2 above to be exected before doing LOCK in
|
|
# con3.
|
|
-- connection con1
|
|
let $wait_condition =
|
|
SELECT COUNT(*) = 1 FROM information_schema.processlist
|
|
WHERE info = 'LOCK TABLE bug38231 WRITE';
|
|
-- source include/wait_condition.inc
|
|
# the above enables query log, re-disable it
|
|
-- disable_query_log
|
|
|
|
-- connection con3
|
|
SET autocommit=0;
|
|
-- send
|
|
LOCK TABLE bug38231 WRITE;
|
|
|
|
-- connection default
|
|
-- send
|
|
TRUNCATE TABLE bug38231;
|
|
|
|
-- connection con1
|
|
# Wait for TRUNCATE and the other two LOCKs to be executed; without this,
|
|
# sometimes UNLOCK executes before them. We assume there are no other
|
|
# sessions executing at the same time with the same SQL commands.
|
|
let $wait_condition =
|
|
SELECT COUNT(*) = 1 FROM information_schema.processlist
|
|
WHERE info = 'TRUNCATE TABLE bug38231';
|
|
-- source include/wait_condition.inc
|
|
let $wait_condition =
|
|
SELECT COUNT(*) = 2 FROM information_schema.processlist
|
|
WHERE info = 'LOCK TABLE bug38231 WRITE';
|
|
-- source include/wait_condition.inc
|
|
# the above enables query log, re-disable it
|
|
-- disable_query_log
|
|
|
|
# this crashes the server if the bug is present
|
|
UNLOCK TABLES;
|
|
|
|
# clean up
|
|
|
|
-- connection con2
|
|
-- error 0, 1205
|
|
-- reap
|
|
UNLOCK TABLES;
|
|
|
|
-- connection con3
|
|
#
|
|
# We may get a timeout error here if the tables are locked in a different
|
|
# order than expected. This is ok as the purpose of this patch is to ensure
|
|
# we don't get a crash in the previous unlock tables.
|
|
-- error 0, 1205
|
|
-- reap
|
|
UNLOCK TABLES;
|
|
|
|
-- connection default
|
|
-- reap
|
|
|
|
-- disconnect con1
|
|
-- disconnect con2
|
|
-- disconnect con3
|
|
|
|
# test that TRUNCATE works with with row-level locks
|
|
|
|
-- enable_query_log
|
|
-- enable_result_log
|
|
|
|
INSERT INTO bug38231 VALUES (1), (10), (300);
|
|
|
|
-- connect (con4,localhost,root,,)
|
|
|
|
-- connection con4
|
|
SET autocommit=0;
|
|
SELECT * FROM bug38231 FOR UPDATE;
|
|
|
|
-- connection default
|
|
TRUNCATE TABLE bug38231;
|
|
|
|
-- connection con4
|
|
COMMIT;
|
|
|
|
-- connection default
|
|
|
|
-- disconnect con4
|
|
|
|
DROP TABLE bug38231;
|