Skip to content

Commit

Permalink
PS-3411: Prevent creation of xb_doublewrite file when innodb_doublewr…
Browse files Browse the repository at this point in the history
…ite is disabled

https://jira.percona.com/browse/PS-3411

Unnecessary xb_doublewrite file is no more created when innodb_doublewrite option is disabled.
  • Loading branch information
kamil-holubicki committed Sep 23, 2019
1 parent fd35368 commit 14318e4
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
33 changes: 33 additions & 0 deletions mysql-test/suite/innodb/r/percona_doublewrite.result
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,38 @@ SET GLOBAL innodb_fast_shutdown=2;
# restart:--innodb-force-recovery=6
# Test that --innodb_force_recovery=6 succeeds to start without the doublewrite file
# restart:--innodb-force-recovery=6
#
# Bug PS-3411: Parallel doublewrite buffer file created when skip-innodb_doublewrite is set
#
# restart:<hidden args>
CREATE TABLE t1 (a INT);
SELECT * FROM t1 ORDER BY a DESC LIMIT 10;
a
1000
999
998
997
996
995
994
993
992
991
DROP TABLE t1;
# restart:<hidden args>
CREATE TABLE t1 (a INT);
SELECT * FROM t1 ORDER BY a DESC LIMIT 10;
a
1000
999
998
997
996
995
994
993
992
991
DROP TABLE t1;
# Cleanup
# restart
56 changes: 56 additions & 0 deletions mysql-test/suite/innodb/t/percona_doublewrite.test
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,62 @@ SET GLOBAL innodb_fast_shutdown=2;
--let $restart_parameters=restart:--innodb-force-recovery=6
--source include/start_mysqld.inc

--echo #
--echo # Bug PS-3411: Parallel doublewrite buffer file created when skip-innodb_doublewrite is set
--echo #

--let $restart_hide_args= 1
--let $restart_parameters= restart:--innodb-parallel-doublewrite-path=$DOUBLEWRITE_FILE
--source include/restart_mysqld.inc
file_exists $DOUBLEWRITE_FILE;

CREATE TABLE t1 (a INT);

--let $i= 1000
--disable_query_log
START TRANSACTION;
while($i)
{
--eval INSERT INTO t1 VALUES ($i);
--dec $i
}
COMMIT;
--enable_query_log

# wait until pages flushed
--let $wait_condition= SELECT variable_value = 0 FROM performance_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_dirty'
--source include/wait_condition.inc

SELECT * FROM t1 ORDER BY a DESC LIMIT 10;
DROP TABLE t1;

--let $restart_hide_args= 1
--let $restart_parameters= "restart:--innodb-parallel-doublewrite-path=$DOUBLEWRITE_FILE --skip-innodb-doublewrite"
--source include/restart_mysqld.inc
--error 1
--file_exists $DOUBLEWRITE_FILE;

# check that it still works
CREATE TABLE t1 (a INT);

--let $i= 1000
--disable_query_log
START TRANSACTION;
while($i)
{
--eval INSERT INTO t1 VALUES ($i);
--dec $i
}
COMMIT;
--enable_query_log

# wait until pages flushed
--let $wait_condition= SELECT variable_value = 0 FROM performance_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_dirty'
--source include/wait_condition.inc

SELECT * FROM t1 ORDER BY a DESC LIMIT 10;
DROP TABLE t1;

--echo # Cleanup
--let $restart_parameters=
--source include/restart_mysqld.inc
4 changes: 4 additions & 0 deletions storage/innobase/buf/buf0dblwr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,10 @@ the disk file.
dberr_t
buf_parallel_dblwr_create(void)
{
if (!srv_use_doublewrite_buf) {
return(DB_SUCCESS);
}

if (!parallel_dblwr_buf.file.is_closed() || srv_read_only_mode) {

ut_ad(parallel_dblwr_buf.recovery_buf_unaligned == NULL);
Expand Down

0 comments on commit 14318e4

Please sign in to comment.