diff --git a/mysql-test/main/flush_read_lock.result b/mysql-test/main/flush_read_lock.result index 948b4fb062b..72ae769c0e9 100644 --- a/mysql-test/main/flush_read_lock.result +++ b/mysql-test/main/flush_read_lock.result @@ -1854,3 +1854,24 @@ connection con2; disconnect con2; connection default; SET DEBUG_SYNC= 'RESET'; +# End of 10.4 tests +# +# MDEV-35417 InnoDB crashes under ... AND DISABLE CHECKPOINT +# +set global innodb_stats_persistent=0; +create table t (a int) engine=innodb; +set global innodb_stats_persistent=1; +alter table t add column b int; +flush tables with read lock and disable checkpoint; +insert into t values (1,2) ; +ERROR HY000: Can't execute the query because you have a conflicting read lock +unlock tables; +drop table t; +flush tables with read lock and disable checkpoint; +create temporary table t(a int) engine=innodb; +unlock tables; +drop table t; +# restart: --innodb-read-only +flush tables with read lock and disable checkpoint; +# restart +# End of 11.7 tests diff --git a/mysql-test/main/flush_read_lock.test b/mysql-test/main/flush_read_lock.test index f24f6e389f1..3f8bde09bef 100644 --- a/mysql-test/main/flush_read_lock.test +++ b/mysql-test/main/flush_read_lock.test @@ -2269,3 +2269,35 @@ reap; disconnect con2; connection default; SET DEBUG_SYNC= 'RESET'; + +--echo # End of 10.4 tests + +--echo # +--echo # MDEV-35417 InnoDB crashes under ... AND DISABLE CHECKPOINT +--echo # + +# case 1 +set global innodb_stats_persistent=0; +create table t (a int) engine=innodb; +set global innodb_stats_persistent=1; +alter table t add column b int; +flush tables with read lock and disable checkpoint; +--error ER_CANT_UPDATE_WITH_READLOCK +insert into t values (1,2) ; +unlock tables; +drop table t; + +# case 2 +flush tables with read lock and disable checkpoint; +create temporary table t(a int) engine=innodb; +unlock tables; +drop table t; + +# case 3 +--let $restart_parameters=--innodb-read-only +--source include/restart_mysqld.inc +flush tables with read lock and disable checkpoint; +--let $restart_parameters= +--source include/restart_mysqld.inc + +--echo # End of 11.7 tests diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index f8eef5a1965..0be423e28dc 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1889,6 +1889,12 @@ static void sst_enable_innodb_writes() static void innodb_disable_internal_writes(bool disable) { + /* + this works only in the SST donor thread and is not yet fixed + to work in a normal connection thread + */ + if (thd_get_thread_id(current_thd)) // if normal thread + return; if (disable) sst_disable_innodb_writes(); else