summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-04-06 10:30:49 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-04-06 10:30:49 +0300
commit5d8dcfd86c5eb8c588ecf17519884dffcf8b0818 (patch)
tree90d716dcfcc9d7462064584546dcf52192dce8e2
parentcacb61b6be78b01a9c62890cc81d059ee46921ac (diff)
parentcbdf62ae907ad42ceb7a65e070b821bb45e07be9 (diff)
downloadmariadb-git-5d8dcfd86c5eb8c588ecf17519884dffcf8b0818.tar.gz
MDEV-25975: Merge 10.4 into 10.5
-rw-r--r--extra/mariabackup/xtrabackup.cc12
-rw-r--r--mysql-test/include/have_innodb_disallow_writes.inc6
-rw-r--r--mysql-test/suite/galera/r/MW-328C.result25
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_shutdown.result1
-rw-r--r--mysql-test/suite/galera/r/galera_drop_database.result3
-rw-r--r--mysql-test/suite/galera/r/galera_events2.result1
-rw-r--r--mysql-test/suite/galera/r/galera_restart_on_unknown_option.result1
-rw-r--r--mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result30
-rw-r--r--mysql-test/suite/galera/t/MW-328C.cnf7
-rw-r--r--mysql-test/suite/galera/t/MW-328C.test36
-rw-r--r--mysql-test/suite/galera/t/galera_bf_abort_shutdown.test1
-rw-r--r--mysql-test/suite/galera/t/galera_drop_database.test1
-rw-r--r--mysql-test/suite/galera/t/galera_events2.test2
-rw-r--r--mysql-test/suite/galera/t/galera_restart_on_unknown_option.test1
-rw-r--r--mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test72
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_disallow_writes_basic.result45
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result2
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_disallow_writes_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_innodb.test2
-rw-r--r--scripts/wsrep_sst_rsync.sh14
-rw-r--r--sql/handler.cc16
-rw-r--r--sql/handler.h5
-rw-r--r--sql/wsrep_sst.cc85
-rw-r--r--storage/innobase/buf/buf0flu.cc4
-rw-r--r--storage/innobase/dict/dict0stats_bg.cc2
-rw-r--r--storage/innobase/fts/fts0opt.cc39
-rw-r--r--storage/innobase/handler/ha_innodb.cc93
-rw-r--r--storage/innobase/include/srv0srv.h7
-rw-r--r--storage/innobase/innodb.cmake8
-rw-r--r--storage/innobase/log/log0log.cc3
-rw-r--r--storage/innobase/os/os0file.cc29
-rw-r--r--storage/innobase/row/row0merge.cc5
-rw-r--r--storage/innobase/srv/srv0srv.cc27
-rw-r--r--storage/innobase/srv/srv0start.cc6
34 files changed, 161 insertions, 472 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 03a0a1fd08e..0b0d8cb808e 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -4479,11 +4479,6 @@ fail:
trx_pool_init();
recv_sys.create();
-#ifdef WITH_INNODB_DISALLOW_WRITES
- srv_allow_writes_event = os_event_create(0);
- os_event_set(srv_allow_writes_event);
-#endif
-
xb_filters_init();
xb_fil_io_init();
@@ -5931,10 +5926,6 @@ static bool xtrabackup_prepare_func(char** argv)
log_sys.create();
recv_sys.recovery_on = true;
-#ifdef WITH_INNODB_DISALLOW_WRITES
- srv_allow_writes_event = os_event_create(0);
- os_event_set(srv_allow_writes_event);
-#endif
xb_fil_io_init();
if (dberr_t err = xb_load_tablespaces()) {
msg("mariabackup: error: xb_data_files_init() failed "
@@ -5957,9 +5948,6 @@ static bool xtrabackup_prepare_func(char** argv)
xb_filter_hash_free(&inc_dir_tables_hash);
fil_system.close();
-#ifdef WITH_INNODB_DISALLOW_WRITES
- os_event_destroy(srv_allow_writes_event);
-#endif
innodb_free_param();
log_sys.close();
sync_check_close();
diff --git a/mysql-test/include/have_innodb_disallow_writes.inc b/mysql-test/include/have_innodb_disallow_writes.inc
deleted file mode 100644
index 83b516b7a34..00000000000
--- a/mysql-test/include/have_innodb_disallow_writes.inc
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_innodb.inc
-
-if (`SELECT COUNT(*) = 0 from INFORMATION_SCHEMA.GLOBAL_VARIABLES
- WHERE VARIABLE_NAME = 'INNODB_DISALLOW_WRITES'`) {
- --skip Test requires 'innodb_disallow_writes'
-}
diff --git a/mysql-test/suite/galera/r/MW-328C.result b/mysql-test/suite/galera/r/MW-328C.result
deleted file mode 100644
index 7a00bb718de..00000000000
--- a/mysql-test/suite/galera/r/MW-328C.result
+++ /dev/null
@@ -1,25 +0,0 @@
-connection node_2;
-connection node_1;
-CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
-INSERT INTO t1 (f1) VALUES (1);
-CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB;
-CREATE PROCEDURE proc_update ()
-BEGIN
-DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
-SET SESSION wsrep_sync_wait = 0;
-WHILE 1 DO
-UPDATE t1 SET f2 = LEFT(MD5(RAND()), 4);
-END WHILE;
-END|
-connect node_1X, 127.0.0.1, root, , test, $NODE_MYPORT_1;
-connection node_1X;
-CALL proc_update();;
-connection node_2;
-SET SESSION wsrep_retry_autocommit = 10000;
-connection node_1;
-connection node_1X;
-Got one of the listed errors
-connection node_1;
-DROP PROCEDURE proc_update;
-DROP TABLE t1, t2;
-CALL mtr.add_suppression("conflict state ABORTED after post commit");
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result b/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result
index fa2a5c373f2..5707b68e190 100644
--- a/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result
+++ b/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result
@@ -5,6 +5,7 @@ connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY);
connection node_2;
+call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*");
SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR continue';
INSERT INTO t1 VALUES (1);
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
diff --git a/mysql-test/suite/galera/r/galera_drop_database.result b/mysql-test/suite/galera/r/galera_drop_database.result
index 6ab4b3d0c7b..03b55136c6f 100644
--- a/mysql-test/suite/galera/r/galera_drop_database.result
+++ b/mysql-test/suite/galera/r/galera_drop_database.result
@@ -48,3 +48,6 @@ SHOW TABLES;
Tables_in_fts
DROP DATABASE fts;
connection node_2;
+call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:");
+Warnings:
+Note 1049 Unknown database 'fts'
diff --git a/mysql-test/suite/galera/r/galera_events2.result b/mysql-test/suite/galera/r/galera_events2.result
index cd44579af90..26d3a74a7f3 100644
--- a/mysql-test/suite/galera/r/galera_events2.result
+++ b/mysql-test/suite/galera/r/galera_events2.result
@@ -111,6 +111,7 @@ f1 f2
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
def test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND SLAVESIDE_DISABLED NOT PRESERVE
+call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*");
connection node_1;
SELECT * FROM t1;
f1 f2
diff --git a/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result b/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result
index 6e672c2d444..b1ee6f5955f 100644
--- a/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result
+++ b/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result
@@ -41,6 +41,7 @@ f1 f2
connection node_2;
Starting server ...
Starting server ...
+call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:");
SELECT * FROM t1;
f1 f2
1 a
diff --git a/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result b/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result
deleted file mode 100644
index 758c34ee62e..00000000000
--- a/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result
+++ /dev/null
@@ -1,30 +0,0 @@
-connection node_2;
-connection node_1;
-connection node_1a;
-SET SESSION wsrep_sync_wait = 0;
-connection node_1;
-CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB;
-CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
-INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-SET GLOBAL innodb_disallow_writes=ON;
-INSERT INTO t1 (f2) SELECT 'abcde ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
-connection node_2;
-INSERT INTO t1 (f2) SELECT 'fghij ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
-SELECT COUNT(*) AS EXPECT_10000 FROM t1;
-EXPECT_10000
-10000
-connection node_1a;
-SET GLOBAL innodb_disallow_writes=OFF;
-connection node_1;
-SELECT COUNT(*) AS EXPECT_20000 FROM t1;
-EXPECT_20000
-20000
-connection node_2;
-SELECT COUNT(*) AS EXPECT_20000 FROM t1;
-EXPECT_20000
-20000
-connection node_1;
-connection node_2;
-DROP TABLE t1;
-DROP TABLE ten;
-disconnect node_1a;
diff --git a/mysql-test/suite/galera/t/MW-328C.cnf b/mysql-test/suite/galera/t/MW-328C.cnf
deleted file mode 100644
index e68f891792c..00000000000
--- a/mysql-test/suite/galera/t/MW-328C.cnf
+++ /dev/null
@@ -1,7 +0,0 @@
-!include ../galera_2nodes.cnf
-
-[mysqld.1]
-wsrep-debug=SERVER
-
-[mysqld.2]
-wsrep-debug=SERVER
diff --git a/mysql-test/suite/galera/t/MW-328C.test b/mysql-test/suite/galera/t/MW-328C.test
deleted file mode 100644
index c3370a3decd..00000000000
--- a/mysql-test/suite/galera/t/MW-328C.test
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# MW-328 Fix unnecessary/silent BF aborts
-#
-
-#
-# Make sure that a high value of wsrep_retry_autocommit
-# masks all deadlock errors
-#
-
---source include/no_protocol.inc
---source include/galera_cluster.inc
---source suite/galera/t/MW-328-header.inc
-
---connection node_2
---let $count = 100
-
-SET SESSION wsrep_retry_autocommit = 10000;
-
---disable_query_log
-
-while ($count)
-{
- --error 0
- INSERT IGNORE INTO t2 SELECT f2 FROM t1;
-
- --disable_result_log
- --error 0
- SELECT 1 FROM DUAL;
- --enable_result_log
-
- --dec $count
-}
-
---enable_query_log
-
---source suite/galera/t/MW-328-footer.inc
diff --git a/mysql-test/suite/galera/t/galera_bf_abort_shutdown.test b/mysql-test/suite/galera/t/galera_bf_abort_shutdown.test
index c7af8375b3f..42f85ecf7c2 100644
--- a/mysql-test/suite/galera/t/galera_bf_abort_shutdown.test
+++ b/mysql-test/suite/galera/t/galera_bf_abort_shutdown.test
@@ -18,6 +18,7 @@
CREATE TABLE t1 (f1 INT PRIMARY KEY);
--connection node_2
+call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*");
SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR continue';
--send INSERT INTO t1 VALUES (1)
diff --git a/mysql-test/suite/galera/t/galera_drop_database.test b/mysql-test/suite/galera/t/galera_drop_database.test
index 8dc73c1ce38..c1a66e1f66c 100644
--- a/mysql-test/suite/galera/t/galera_drop_database.test
+++ b/mysql-test/suite/galera/t/galera_drop_database.test
@@ -56,6 +56,7 @@ SHOW TABLES;
DROP DATABASE fts;
--connection node_2
+call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:");
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'fts_t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'fts_t2';
diff --git a/mysql-test/suite/galera/t/galera_events2.test b/mysql-test/suite/galera/t/galera_events2.test
index 3dfbe406fc4..b29ad3ba2f2 100644
--- a/mysql-test/suite/galera/t/galera_events2.test
+++ b/mysql-test/suite/galera/t/galera_events2.test
@@ -137,6 +137,8 @@ SELECT * FROM t1;
--echo # node_2 Event should be SERVERSIDE_DISABLED
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*");
+
--connection node_1
SELECT * FROM t1;
--echo # node_1 Event should be ENABLED
diff --git a/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test b/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test
index ed7f106c123..6a0f24dbaae 100644
--- a/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test
+++ b/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test
@@ -125,6 +125,7 @@ SELECT * FROM t1;
# Sanity check (node 2 is running now and can perform SQL operators):
+call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:");
SELECT * FROM t1;
--connection node_1
diff --git a/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test b/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test
deleted file mode 100644
index 10f3815e135..00000000000
--- a/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# This test checks that innodb_disallow_writes works as expected
-#
-# Note that we need to enable binlog for this test: If the commit
-# to InnoDB is done in one phase, the transaction is committed in
-# memory before it is persisted to disk. This means that the
-# innodb_disallow_writes=ON may not prevent transaction to
-# become visible to other readers. On the other hand, if the
-# commit is two phase (as it is with binlog), the transaction
-# will be blocked in prepare phase.
-#
-
---source include/galera_cluster.inc
---source include/have_innodb.inc
---source include/have_log_bin.inc
-
---let $datadir= `SELECT @@datadir`
-
-
-# Open a separate connection to be used to run SHOW PROCESSLIST
---let $galera_connection_name = node_1a
---let $galera_server_number = 1
---source include/galera_connect.inc
---connection node_1a
-SET SESSION wsrep_sync_wait = 0;
-
---connection node_1
-CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB;
-CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
-INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-
-SET GLOBAL innodb_disallow_writes=ON;
---exec find $datadir -type f-exec md5sum {} \; | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_before
-
-#
-# This insert has no effect before innodb_disallow_writes is OFF
-#
---send INSERT INTO t1 (f2) SELECT 'abcde ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
-
---connection node_2
-INSERT INTO t1 (f2) SELECT 'fghij ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
-SELECT COUNT(*) AS EXPECT_10000 FROM t1;
-
---connection node_1a
---sleep 5
-
---exec find $datadir -type f-exec md5sum {} \; | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_after
-
-SET GLOBAL innodb_disallow_writes=OFF;
-
---connection node_1
---reap
---let $wait_condition = SELECT COUNT(*) = 20000 FROM t1;
---source include/wait_condition.inc
-
-SELECT COUNT(*) AS EXPECT_20000 FROM t1;
-
---connection node_2
---let $wait_condition = SELECT COUNT(*) = 20000 FROM t1;
---source include/wait_condition.inc
-SELECT COUNT(*) AS EXPECT_20000 FROM t1;
-
---connection node_1
---diff_files $MYSQLTEST_VARDIR/tmp/innodb_before $MYSQLTEST_VARDIR/tmp/innodb_after
-
---connection node_2
-
-DROP TABLE t1;
-DROP TABLE ten;
-
---disconnect node_1a
-
diff --git a/mysql-test/suite/sys_vars/r/innodb_disallow_writes_basic.result b/mysql-test/suite/sys_vars/r/innodb_disallow_writes_basic.result
deleted file mode 100644
index bfb6b67b5d8..00000000000
--- a/mysql-test/suite/sys_vars/r/innodb_disallow_writes_basic.result
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# innodb_disallow_writes
-#
-# save the initial value
-SET @innodb_disallow_writes_global_saved = @@global.innodb_disallow_writes;
-# default
-SELECT @@global.innodb_disallow_writes;
-@@global.innodb_disallow_writes
-0
-
-# scope
-SELECT @@session.innodb_disallow_writes;
-ERROR HY000: Variable 'innodb_disallow_writes' is a GLOBAL variable
-SET @@global.innodb_disallow_writes=OFF;
-SELECT @@global.innodb_disallow_writes;
-@@global.innodb_disallow_writes
-0
-SET @@global.innodb_disallow_writes=ON;
-SELECT @@global.innodb_disallow_writes;
-@@global.innodb_disallow_writes
-1
-
-# valid values
-SET @@global.innodb_disallow_writes='OFF';
-SELECT @@global.innodb_disallow_writes;
-@@global.innodb_disallow_writes
-0
-SET @@global.innodb_disallow_writes=ON;
-SELECT @@global.innodb_disallow_writes;
-@@global.innodb_disallow_writes
-1
-SET @@global.innodb_disallow_writes=default;
-SELECT @@global.innodb_disallow_writes;
-@@global.innodb_disallow_writes
-0
-
-# invalid values
-SET @@global.innodb_disallow_writes=NULL;
-ERROR 42000: Variable 'innodb_disallow_writes' can't be set to the value of 'NULL'
-SET @@global.innodb_disallow_writes='junk';
-ERROR 42000: Variable 'innodb_disallow_writes' can't be set to the value of 'junk'
-
-# restore the initial value
-SET @@global.innodb_disallow_writes = @innodb_disallow_writes_global_saved;
-# End of test
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index a66f16b5bbc..26df5cd2394 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -2,9 +2,7 @@ select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYP
where variable_name like 'innodb%' and
variable_name not in (
'innodb_version', # always the same as the server version
-'innodb_disallow_writes', # only available WITH_WSREP
'innodb_numa_interleave', # only available WITH_NUMA
-'innodb_sched_priority_cleaner', # linux only
'innodb_evict_tables_on_commit_debug', # one may want to override this
'innodb_use_native_aio', # default value depends on OS
'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing
diff --git a/mysql-test/suite/sys_vars/t/innodb_disallow_writes_basic.test b/mysql-test/suite/sys_vars/t/innodb_disallow_writes_basic.test
deleted file mode 100644
index b8e5c127377..00000000000
--- a/mysql-test/suite/sys_vars/t/innodb_disallow_writes_basic.test
+++ /dev/null
@@ -1,42 +0,0 @@
---source include/have_innodb_disallow_writes.inc
-
---echo #
---echo # innodb_disallow_writes
---echo #
-
---echo # save the initial value
-SET @innodb_disallow_writes_global_saved = @@global.innodb_disallow_writes;
-
---echo # default
-SELECT @@global.innodb_disallow_writes;
-
---echo
---echo # scope
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.innodb_disallow_writes;
-SET @@global.innodb_disallow_writes=OFF;
-SELECT @@global.innodb_disallow_writes;
-SET @@global.innodb_disallow_writes=ON;
-SELECT @@global.innodb_disallow_writes;
-
---echo
---echo # valid values
-SET @@global.innodb_disallow_writes='OFF';
-SELECT @@global.innodb_disallow_writes;
-SET @@global.innodb_disallow_writes=ON;
-SELECT @@global.innodb_disallow_writes;
-SET @@global.innodb_disallow_writes=default;
-SELECT @@global.innodb_disallow_writes;
-
---echo
---echo # invalid values
---error ER_WRONG_VALUE_FOR_VAR
-SET @@global.innodb_disallow_writes=NULL;
---error ER_WRONG_VALUE_FOR_VAR
-SET @@global.innodb_disallow_writes='junk';
-
---echo
---echo # restore the initial value
-SET @@global.innodb_disallow_writes = @innodb_disallow_writes_global_saved;
-
---echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.test b/mysql-test/suite/sys_vars/t/sysvars_innodb.test
index ef52ee3264a..15fd99e9984 100644
--- a/mysql-test/suite/sys_vars/t/sysvars_innodb.test
+++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.test
@@ -9,9 +9,7 @@ select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYP
where variable_name like 'innodb%' and
variable_name not in (
'innodb_version', # always the same as the server version
- 'innodb_disallow_writes', # only available WITH_WSREP
'innodb_numa_interleave', # only available WITH_NUMA
- 'innodb_sched_priority_cleaner', # linux only
'innodb_evict_tables_on_commit_debug', # one may want to override this
'innodb_use_native_aio', # default value depends on OS
'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index 5f7ae4298b5..29e2b390e27 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -3,7 +3,7 @@
set -ue
# Copyright (C) 2017-2022 MariaDB
-# Copyright (C) 2010-2014 Codership Oy
+# Copyright (C) 2010-2022 Codership Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -416,6 +416,8 @@ EOF
sync
+ wsrep_log_info "Tables flushed"
+
if [ -n "$WSREP_SST_OPT_BINLOG" ]; then
# Change the directory to binlog base (if possible):
cd "$DATA"
@@ -557,6 +559,8 @@ FILTER="-f '- /lost+found'
exit $RC
fi
+ wsrep_log_info "Transfer of normal directories done"
+
# Transfer InnoDB data files
rsync ${STUNNEL:+--rsh="$STUNNEL"} \
--owner --group --perms --links --specials \
@@ -570,6 +574,8 @@ FILTER="-f '- /lost+found'
exit 255 # unknown error
fi
+ wsrep_log_info "Transfer of InnoDB data files done"
+
# second, we transfer InnoDB and Aria log files
rsync ${STUNNEL:+--rsh="$STUNNEL"} \
--owner --group --perms --links --specials \
@@ -583,6 +589,8 @@ FILTER="-f '- /lost+found'
exit 255 # unknown error
fi
+ wsrep_log_info "Transfer of InnoDB and Aria log files done"
+
# then, we parallelize the transfer of database directories,
# use '.' so that path concatenation works:
@@ -610,6 +618,9 @@ FILTER="-f '- /lost+found'
exit 255 # unknown error
fi
+ wsrep_log_info "Transfer of data done"
+
+
else # BYPASS
wsrep_log_info "Bypassing state dump."
@@ -620,6 +631,7 @@ FILTER="-f '- /lost+found'
fi
+ wsrep_log_info "Sending continue to donor"
echo 'continue' # now server can resume updating data
echo "$STATE" > "$MAGIC_FILE"
diff --git a/sql/handler.cc b/sql/handler.cc
index 8f960bc486f..89bf1d78e0b 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -927,6 +927,22 @@ void ha_kill_query(THD* thd, enum thd_kill_levels level)
}
+static my_bool plugin_disable_internal_writes(THD *, plugin_ref plugin,
+ void *disable)
+{
+ if (void(*diw)(bool)= plugin_hton(plugin)->disable_internal_writes)
+ diw(*static_cast<bool*>(disable));
+ return FALSE;
+}
+
+
+void ha_disable_internal_writes(bool disable)
+{
+ plugin_foreach(NULL, plugin_disable_internal_writes,
+ MYSQL_STORAGE_ENGINE_PLUGIN, &disable);
+}
+
+
/*****************************************************************************
Backup functions
******************************************************************************/
diff --git a/sql/handler.h b/sql/handler.h
index a93e34b79ea..f3c3819ef0f 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1636,6 +1636,9 @@ struct handlerton
@retval 0 if no system-versioned data was affected by the transaction */
ulonglong (*prepare_commit_versioned)(THD *thd, ulonglong *trx_id);
+ /** Disable or enable the internal writes of a storage engine */
+ void (*disable_internal_writes)(bool disable);
+
/* backup */
void (*prepare_for_backup)(void);
void (*end_backup)(void);
@@ -5116,6 +5119,8 @@ void ha_prepare_for_backup();
void ha_end_backup();
void ha_pre_shutdown();
+void ha_disable_internal_writes(bool disable);
+
/* statistics and info */
bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat);
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index e08ece56877..4a1ae85f4cc 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -1,4 +1,5 @@
/* Copyright 2008-2022 Codership Oy <http://www.codership.com>
+ Copyright (c) 2008, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1496,47 +1497,18 @@ static int run_sql_command(THD *thd, const char *query)
}
mysql_parse(thd, thd->query(), thd->query_length(), &ps, FALSE, FALSE);
+
if (thd->is_error())
{
int const err= thd->get_stmt_da()->sql_errno();
- WSREP_WARN ("Error executing '%s': %d (%s)%s",
- query, err, thd->get_stmt_da()->message(),
- err == ER_UNKNOWN_SYSTEM_VARIABLE ?
- ". Was mysqld built with --with-innodb-disallow-writes ?" : "");
+ WSREP_WARN ("Error executing '%s': %d (%s)",
+ query, err, thd->get_stmt_da()->message());
thd->clear_error();
return -1;
}
return 0;
}
-static void sst_disallow_writes (THD* thd, bool yes)
-{
- char query_str[64]= { 0, };
- ssize_t const query_max= sizeof(query_str) - 1;
- CHARSET_INFO *current_charset;
-
- current_charset= thd->variables.character_set_client;
-
- if (!is_supported_parser_charset(current_charset))
- {
- /* Do not use non-supported parser character sets */
- WSREP_WARN("Current client character set is non-supported parser character set: %s", current_charset->csname);
- thd->variables.character_set_client= &my_charset_latin1;
- WSREP_WARN("For SST temporally setting character set to : %s",
- my_charset_latin1.csname);
- }
-
- snprintf (query_str, query_max, "SET GLOBAL innodb_disallow_writes=%d",
- yes ? 1 : 0);
-
- if (run_sql_command(thd, query_str))
- {
- WSREP_ERROR("Failed to disallow InnoDB writes");
- }
- thd->variables.character_set_client= current_charset;
-}
-
-
static int sst_flush_tables(THD* thd)
{
WSREP_INFO("Flushing tables for SST...");
@@ -1596,16 +1568,11 @@ static int sst_flush_tables(THD* thd)
}
else
{
- WSREP_INFO("Tables flushed.");
+ ha_disable_internal_writes(true);
- /* disable further disk IO */
- sst_disallow_writes(thd, true);
- WSREP_INFO("Disabled further disk IO.");
+ WSREP_INFO("Tables flushed.");
- /*
- Tables have been flushed. Create a file with cluster state ID and
- wsrep_gtid_domain_id.
- */
+ // Create a file with cluster state ID and wsrep_gtid_domain_id.
char content[100];
snprintf(content, sizeof(content), "%s:%lld %d\n", wsrep_cluster_state_uuid,
(long long)wsrep_locked_seqno, wsrep_gtid_server.domain_id);
@@ -1648,6 +1615,8 @@ static int sst_flush_tables(THD* thd)
}
free(real_name);
free(tmp_name);
+ if (err)
+ ha_disable_internal_writes(false);
}
return err;
@@ -1698,31 +1667,30 @@ wait_signal:
if (!strcasecmp (out, magic_flush))
{
err= sst_flush_tables (thd.ptr);
+
if (!err)
{
- /*
+ locked= true;
+ /*
Lets also keep statements that modify binary logs (like RESET LOGS,
RESET MASTER) from proceeding until the files have been transferred
to the joiner node.
*/
if (mysql_bin_log.is_open())
- {
mysql_mutex_lock(mysql_bin_log.get_log_lock());
- }
-
- locked= true;
- WSREP_INFO("Donor state reached");
+ WSREP_INFO("Donor state reached");
DBUG_EXECUTE_IF("sync.wsrep_donor_state",
- {
- const char act[]=
- "now "
- "SIGNAL sync.wsrep_donor_state_reached "
- "WAIT_FOR signal.wsrep_donor_state";
- assert(!debug_sync_set_action(thd.ptr,
- STRING_WITH_LEN(act)));
- };);
+ {
+ const char act[]=
+ "now "
+ "SIGNAL sync.wsrep_donor_state_reached "
+ "WAIT_FOR signal.wsrep_donor_state";
+ assert(!debug_sync_set_action(thd.ptr,
+ STRING_WITH_LEN(act)));
+ };);
+
goto wait_signal;
}
}
@@ -1730,14 +1698,11 @@ wait_signal:
{
if (locked)
{
+ locked= false;
+ ha_disable_internal_writes(false);
if (mysql_bin_log.is_open())
- {
- mysql_mutex_assert_owner(mysql_bin_log.get_log_lock());
mysql_mutex_unlock(mysql_bin_log.get_log_lock());
- }
- sst_disallow_writes (thd.ptr, false);
thd.ptr->global_read_lock.unlock_global_read_lock(thd.ptr);
- locked= false;
}
err= 0;
goto wait_signal;
@@ -1768,12 +1733,12 @@ wait_signal:
if (locked) // don't forget to unlock server before return
{
+ ha_disable_internal_writes(false);
if (mysql_bin_log.is_open())
{
mysql_mutex_assert_owner(mysql_bin_log.get_log_lock());
mysql_mutex_unlock(mysql_bin_log.get_log_lock());
}
- sst_disallow_writes (thd.ptr, false);
thd.ptr->global_read_lock.unlock_global_read_lock(thd.ptr);
}
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 00d96935461..90ead952d63 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -1771,12 +1771,10 @@ static bool log_checkpoint_low(lsn_t oldest_lsn, lsn_t end_lsn)
mysql_mutex_assert_owner(&log_sys.mutex);
ut_ad(oldest_lsn <= end_lsn);
ut_ad(end_lsn == log_sys.get_lsn());
- ut_ad(!recv_no_log_write);
ut_ad(oldest_lsn >= log_sys.last_checkpoint_lsn);
const lsn_t age= oldest_lsn - log_sys.last_checkpoint_lsn;
-
if (age > SIZE_OF_FILE_CHECKPOINT + log_sys.framing_size())
/* Some log has been written since the previous checkpoint. */;
else if (age > SIZE_OF_FILE_CHECKPOINT &&
@@ -1796,6 +1794,8 @@ static bool log_checkpoint_low(lsn_t oldest_lsn, lsn_t end_lsn)
return true;
}
+ ut_ad(!recv_no_log_write);
+
/* Repeat the FILE_MODIFY records after the checkpoint, in case some
log records between the checkpoint and log_sys.lsn need them.
Finally, write a FILE_CHECKPOINT record. Redo log apply expects to
diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc
index afeb8ef6c77..69f50cccbbf 100644
--- a/storage/innobase/dict/dict0stats_bg.cc
+++ b/storage/innobase/dict/dict0stats_bg.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2021, MariaDB Corporation.
+Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index c288dfee6f8..348566ae952 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2021, MariaDB Corporation.
+Copyright (c) 2016, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -37,6 +37,13 @@ Completed 2011/7/10 Sunny and Jimmy Yang
#include "zlib.h"
#include "fts0opt.h"
#include "fts0vlc.h"
+#include "wsrep.h"
+
+#ifdef WITH_WSREP
+extern Atomic_relaxed<bool> wsrep_sst_disable_writes;
+#else
+constexpr bool wsrep_sst_disable_writes= false;
+#endif
/** The FTS optimize thread's work queue. */
ib_wqueue_t* fts_optimize_wq;
@@ -2851,6 +2858,20 @@ static void fts_optimize_callback(void *)
&& ib_wqueue_is_empty(fts_optimize_wq)
&& n_tables > 0
&& n_optimize > 0) {
+
+ /* The queue is empty but we have tables
+ to optimize. */
+ if (UNIV_UNLIKELY(wsrep_sst_disable_writes)) {
+retry_later:
+ if (fts_is_sync_needed()) {
+ fts_need_sync = true;
+ }
+ if (n_tables) {
+ timer->set_time(5000, 0);
+ }
+ return;
+ }
+
fts_slot_t* slot = static_cast<fts_slot_t*>(
ib_vector_get(fts_slots, current));
@@ -2865,19 +2886,13 @@ static void fts_optimize_callback(void *)
n_optimize = fts_optimize_how_many();
current = 0;
}
-
} else if (n_optimize == 0
|| !ib_wqueue_is_empty(fts_optimize_wq)) {
fts_msg_t* msg = static_cast<fts_msg_t*>
(ib_wqueue_nowait(fts_optimize_wq));
/* Timeout ? */
- if (msg == NULL) {
- if (fts_is_sync_needed()) {
- fts_need_sync = true;
- }
- if (n_tables)
- timer->set_time(5000, 0);
- return;
+ if (!msg) {
+ goto retry_later;
}
switch (msg->type) {
@@ -2908,6 +2923,11 @@ static void fts_optimize_callback(void *)
break;
case FTS_MSG_SYNC_TABLE:
+ if (UNIV_UNLIKELY(wsrep_sst_disable_writes)) {
+ add_msg(msg);
+ goto retry_later;
+ }
+
DBUG_EXECUTE_IF(
"fts_instrument_msg_sync_sleep",
os_thread_sleep(300000););
@@ -2967,7 +2987,6 @@ fts_optimize_init(void)
/* Create FTS optimize work queue */
fts_optimize_wq = ib_wqueue_create();
- ut_a(fts_optimize_wq != NULL);
timer = srv_thread_pool->create_timer(timer_callback);
/* Create FTS vector to store fts_slot_t */
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 2e00d41133b..042999d33cb 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -107,9 +107,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "srv0mon.h"
#include "srv0start.h"
#include "rem0rec.h"
-#ifdef UNIV_DEBUG
#include "trx0purge.h"
-#endif /* UNIV_DEBUG */
#include "trx0roll.h"
#include "trx0rseg.h"
#include "trx0trx.h"
@@ -1621,6 +1619,57 @@ thd_to_trx_id(
return(thd_to_trx(thd)->id);
}
+Atomic_relaxed<bool> wsrep_sst_disable_writes;
+
+static void sst_disable_innodb_writes()
+{
+ const uint old_count= srv_n_fil_crypt_threads;
+ fil_crypt_set_thread_cnt(0);
+ srv_n_fil_crypt_threads= old_count;
+
+ wsrep_sst_disable_writes= true;
+ dict_stats_shutdown();
+ purge_sys.stop();
+ /* We are holding a global MDL thanks to FLUSH TABLES WITH READ LOCK.
+
+ That will prevent any writes from arriving into InnoDB, but it will
+ not prevent writes of modified pages from the buffer pool, or log
+ checkpoints.
+
+ Let us perform a log checkpoint to ensure that the entire buffer
+ pool is clean, so that no writes to persistent files will be
+ possible during the snapshot, and to guarantee that no crash
+ recovery will be necessary when starting up on the snapshot. */
+ log_make_checkpoint();
+ /* If any FILE_MODIFY records were written by the checkpoint, an
+ extra write of a FILE_CHECKPOINT record could still be invoked by
+ buf_flush_page_cleaner(). Let us prevent that by invoking another
+ checkpoint (which will write the FILE_CHECKPOINT record). */
+ log_make_checkpoint();
+ ut_d(recv_no_log_write= true);
+ /* If this were not a no-op, an assertion would fail due to
+ recv_no_log_write. */
+ ut_d(log_make_checkpoint());
+}
+
+static void sst_enable_innodb_writes()
+{
+ ut_ad(recv_no_log_write);
+ ut_d(recv_no_log_write= false);
+ dict_stats_start();
+ purge_sys.resume();
+ wsrep_sst_disable_writes= false;
+ fil_crypt_set_thread_cnt(srv_n_fil_crypt_threads);
+}
+
+static void innodb_disable_internal_writes(bool disable)
+{
+ if (disable)
+ sst_disable_innodb_writes();
+ else
+ sst_enable_innodb_writes();
+}
+
static void wsrep_abort_transaction(handlerton*, THD *, THD *, my_bool);
static int innobase_wsrep_set_checkpoint(handlerton* hton, const XID* xid);
static int innobase_wsrep_get_checkpoint(handlerton* hton, XID* xid);
@@ -3149,9 +3198,6 @@ static int innodb_init_abort()
}
srv_tmp_space.shutdown();
-#ifdef WITH_INNODB_DISALLOW_WRITES
- os_event_destroy(srv_allow_writes_event);
-#endif /* WITH_INNODB_DISALLOW_WRITES */
DBUG_RETURN(1);
}
@@ -3954,6 +4000,7 @@ static int innodb_init(void* p)
innobase_hton->abort_transaction=wsrep_abort_transaction;
innobase_hton->set_checkpoint=innobase_wsrep_set_checkpoint;
innobase_hton->get_checkpoint=innobase_wsrep_get_checkpoint;
+ innobase_hton->disable_internal_writes=innodb_disable_internal_writes;
#endif /* WITH_WSREP */
innobase_hton->tablefile_extensions = ha_innobase_exts;
@@ -19668,39 +19715,6 @@ static MYSQL_SYSVAR_ULONG(buf_dump_status_frequency, srv_buf_dump_status_frequen
"dumped. Default is 0 (only start and end status is printed).",
NULL, NULL, 0, 0, 100, 0);
-#ifdef WITH_INNODB_DISALLOW_WRITES
-/*******************************************************
- * innobase_disallow_writes variable definition *
- *******************************************************/
-
-/* Must always init to FALSE. */
-static my_bool innobase_disallow_writes = FALSE;
-
-/**************************************************************************
-An "update" method for innobase_disallow_writes variable. */
-static
-void
-innobase_disallow_writes_update(THD*, st_mysql_sys_var*,
- void* var_ptr, const void* save)
-{
- const my_bool val = *static_cast<const my_bool*>(save);
- *static_cast<my_bool*>(var_ptr) = val;
- ut_a(srv_allow_writes_event);
- mysql_mutex_unlock(&LOCK_global_system_variables);
- if (val) {
- os_event_reset(srv_allow_writes_event);
- } else {
- os_event_set(srv_allow_writes_event);
- }
- mysql_mutex_lock(&LOCK_global_system_variables);
-}
-
-static MYSQL_SYSVAR_BOOL(disallow_writes, innobase_disallow_writes,
- PLUGIN_VAR_NOCMDOPT,
- "Tell InnoDB to stop any writes to disk",
- NULL, innobase_disallow_writes_update, FALSE);
-#endif /* WITH_INNODB_DISALLOW_WRITES */
-
static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead,
PLUGIN_VAR_NOCMDARG,
"Whether to use read ahead for random access within an extent.",
@@ -20090,9 +20104,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(change_buffer_dump),
MYSQL_SYSVAR(change_buffering_debug),
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
-#ifdef WITH_INNODB_DISALLOW_WRITES
- MYSQL_SYSVAR(disallow_writes),
-#endif /* WITH_INNODB_DISALLOW_WRITES */
MYSQL_SYSVAR(random_read_ahead),
MYSQL_SYSVAR(read_ahead_threshold),
MYSQL_SYSVAR(read_only),
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 889652039a9..15df5d4cfbc 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -3,7 +3,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2021, MariaDB Corporation.
+Copyright (c) 2013, 2022, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -291,11 +291,6 @@ extern ulong srv_log_write_ahead_size;
extern my_bool srv_adaptive_flushing;
extern my_bool srv_flush_sync;
-#ifdef WITH_INNODB_DISALLOW_WRITES
-/* When this event is reset we do not allow any file writes to take place. */
-extern os_event_t srv_allow_writes_event;
-#endif /* WITH_INNODB_DISALLOW_WRITES */
-
/* If this flag is TRUE, then we will load the indexes' (and tables') metadata
even if they are marked as "corrupted". Mostly it is for DBA to process
corrupted index and table */
diff --git a/storage/innobase/innodb.cmake b/storage/innobase/innodb.cmake
index cd8ba4f04d3..65d26aa6799 100644
--- a/storage/innobase/innodb.cmake
+++ b/storage/innobase/innodb.cmake
@@ -1,5 +1,5 @@
# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
-# Copyright (c) 2017, 2020, MariaDB Corporation.
+# Copyright (c) 2017, 2022, MariaDB Corporation.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -149,12 +149,6 @@ ELSE()
ADD_DEFINITIONS(-DMUTEX_SYS)
ENDIF()
-OPTION(WITH_INNODB_DISALLOW_WRITES "InnoDB freeze writes patch from Google" ${WITH_WSREP})
-IF (WITH_INNODB_DISALLOW_WRITES)
- ADD_DEFINITIONS(-DWITH_INNODB_DISALLOW_WRITES)
-ENDIF()
-ADD_FEATURE_INFO(INNODB_DISALLOW_WRITES WITH_INNODB_DISALLOW_WRITES "Expose innodb_disallow_writes switch to stop innodb from writing to disk")
-
# Include directories under innobase
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/innobase/include
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 69b5599811d..39d606c120a 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -690,7 +690,6 @@ mutex is released in the function.
static void log_write(bool rotate_key)
{
mysql_mutex_assert_owner(&log_sys.mutex);
- ut_ad(!recv_no_log_write);
lsn_t write_lsn;
if (log_sys.buf_free == log_sys.buf_next_to_write) {
/* Nothing to write */
@@ -698,6 +697,8 @@ static void log_write(bool rotate_key)
return;
}
+ ut_ad(!recv_no_log_write);
+
ulint start_offset;
ulint end_offset;
ulint area_start;
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index fb240943298..42589b3319a 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -153,14 +153,6 @@ static ulint os_innodb_umask = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
static ulint os_innodb_umask = 0;
#endif /* _WIN32 */
-
-#ifdef WITH_INNODB_DISALLOW_WRITES
-#define WAIT_ALLOW_WRITES() os_event_wait(srv_allow_writes_event)
-#else
-#define WAIT_ALLOW_WRITES() do { } while (0)
-#endif /* WITH_INNODB_DISALLOW_WRITES */
-
-
Atomic_counter<ulint> os_n_file_reads;
static ulint os_bytes_read_since_printout;
ulint os_n_file_writes;
@@ -382,7 +374,6 @@ FILE*
os_file_create_tmpfile()
{
FILE* file = NULL;
- WAIT_ALLOW_WRITES();
File fd = mysql_tmpfile("ib");
if (fd >= 0) {
@@ -990,7 +981,6 @@ os_file_flush_func(
{
int ret;
- WAIT_ALLOW_WRITES();
ret = os_file_sync_posix(file);
if (ret == 0) {
@@ -1042,10 +1032,6 @@ os_file_create_simple_func(
int create_flag;
const char* mode_str = NULL;
- if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW) {
- WAIT_ALLOW_WRITES();
- }
-
ut_a(!(create_mode & OS_FILE_ON_ERROR_SILENT));
ut_a(!(create_mode & OS_FILE_ON_ERROR_NO_EXIT));
@@ -1163,7 +1149,6 @@ os_file_create_directory(
{
int rcode;
- WAIT_ALLOW_WRITES();
rcode = mkdir(pathname, 0770);
if (!(rcode == 0 || (errno == EEXIST && !fail_if_exists))) {
@@ -1370,10 +1355,6 @@ os_file_create_simple_no_error_handling_func(
os_file_t file;
int create_flag;
- if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW) {
- WAIT_ALLOW_WRITES();
- }
-
ut_a(!(create_mode & OS_FILE_ON_ERROR_SILENT));
ut_a(!(create_mode & OS_FILE_ON_ERROR_NO_EXIT));
@@ -1448,7 +1429,6 @@ os_file_delete_if_exists_func(
}
int ret;
- WAIT_ALLOW_WRITES();
ret = unlink(name);
@@ -1473,7 +1453,6 @@ os_file_delete_func(
const char* name)
{
int ret;
- WAIT_ALLOW_WRITES();
ret = unlink(name);
@@ -1512,7 +1491,6 @@ os_file_rename_func(
#endif /* UNIV_DEBUG */
int ret;
- WAIT_ALLOW_WRITES();
ret = rename(oldpath, newpath);
@@ -1687,7 +1665,6 @@ bool
os_file_set_eof(
FILE* file) /*!< in: file to be truncated */
{
- WAIT_ALLOW_WRITES();
return(!ftruncate(fileno(file), ftell(file)));
}
@@ -2155,10 +2132,6 @@ os_file_create_func(
? FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE
: FILE_SHARE_READ | FILE_SHARE_DELETE;
- if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW) {
- WAIT_ALLOW_WRITES();
- }
-
on_error_no_exit = create_mode & OS_FILE_ON_ERROR_NO_EXIT
? true : false;
@@ -2943,8 +2916,6 @@ os_file_write_func(
ut_ad(n > 0);
- WAIT_ALLOW_WRITES();
-
ssize_t n_bytes = os_file_pwrite(type, file, (byte*)buf, n, offset, &err);
if ((ulint) n_bytes != n && !os_has_said_disk_full) {
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 14bd82f5a97..41a4a0b82d3 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2021, MariaDB Corporation.
+Copyright (c) 2014, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -4055,9 +4055,6 @@ pfs_os_file_t
row_merge_file_create_low(
const char* path)
{
-#ifdef WITH_INNODB_DISALLOW_WRITES
- os_event_wait(srv_allow_writes_event);
-#endif /* WITH_INNODB_DISALLOW_WRITES */
if (!path) {
path = mysql_tmpdir;
}
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 09cf547b831..a308839ce4f 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -3,7 +3,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2021, MariaDB Corporation.
+Copyright (c) 2013, 2022, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -194,10 +194,6 @@ srv_printf_innodb_monitor() will request mutex acquisition
with mutex_enter(), which will wait until it gets the mutex. */
#define MUTEX_NOWAIT(mutex_skipped) ((mutex_skipped) < MAX_MUTEX_NOWAIT)
-#ifdef WITH_INNODB_DISALLOW_WRITES
-UNIV_INTERN os_event_t srv_allow_writes_event;
-#endif /* WITH_INNODB_DISALLOW_WRITES */
-
/** copy of innodb_buffer_pool_size */
ulint srv_buf_pool_size;
/** Requested buffer pool chunk size. Each buffer pool instance consists
@@ -675,18 +671,8 @@ static void srv_init()
mutex_create(LATCH_ID_PAGE_ZIP_STAT_PER_INDEX,
&page_zip_stat_per_index_mutex);
-#ifdef WITH_INNODB_DISALLOW_WRITES
- /* Writes have to be enabled on init or else we hang. Thus, we
- always set the event here regardless of innobase_disallow_writes.
- That flag will always be 0 at this point because it isn't settable
- via my.cnf or command line arg. */
- srv_allow_writes_event = os_event_create(0);
- os_event_set(srv_allow_writes_event);
-#endif /* WITH_INNODB_DISALLOW_WRITES */
-
/* Initialize some INFORMATION SCHEMA internal structures */
trx_i_s_cache_init(trx_i_s_cache);
-
}
/*********************************************************************//**
@@ -1341,17 +1327,6 @@ void srv_monitor_task(void*)
if (sync_array_print_long_waits(&waiter, &sema)
&& sema == old_sema && os_thread_eq(waiter, old_waiter)) {
-#if defined(WITH_WSREP) && defined(WITH_INNODB_DISALLOW_WRITES)
- if (!os_event_is_set(srv_allow_writes_event)) {
- fprintf(stderr,
- "WSREP: avoiding InnoDB self crash due to "
- "long semaphore wait of > %lu seconds\n"
- "Server is processing SST donor operation, "
- "fatal_cnt now: " ULINTPF,
- srv_fatal_semaphore_wait_threshold, fatal_cnt);
- return;
- }
-#endif /* WITH_WSREP */
if (fatal_cnt++) {
ib::fatal() << "Semaphore wait has lasted > "
<< srv_fatal_semaphore_wait_threshold
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index f3213f891eb..bf59da1cd16 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -3,7 +3,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2021, MariaDB Corporation.
+Copyright (c) 2013, 2022, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -2108,10 +2108,6 @@ void innodb_shutdown()
}
srv_tmp_space.shutdown();
-#ifdef WITH_INNODB_DISALLOW_WRITES
- os_event_destroy(srv_allow_writes_event);
-#endif /* WITH_INNODB_DISALLOW_WRITES */
-
if (srv_was_started && srv_print_verbose_log) {
ib::info() << "Shutdown completed; log sequence number "
<< srv_shutdown_lsn