Skip to content

Commit 97b32c4

Browse files
committed
Merge 10.6 into 10.11
2 parents 5242ae2 + 7301fba commit 97b32c4

File tree

20 files changed

+275
-233
lines changed

20 files changed

+275
-233
lines changed

extra/mariabackup/xtrabackup.cc

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6096,16 +6096,12 @@ xb_delta_open_matching_space(
60966096
ut_ad(fil_space_t::physical_size(flags) == info.page_size);
60976097

60986098
mysql_mutex_lock(&fil_system.mutex);
6099-
fil_space_t* space = fil_space_t::create(uint32_t(info.space_id),
6100-
flags, false, 0,
6101-
FIL_ENCRYPTION_DEFAULT, true);
6099+
std::ignore = fil_space_t::create(uint32_t(info.space_id),
6100+
flags, false, 0,
6101+
FIL_ENCRYPTION_DEFAULT, true);
61026102
mysql_mutex_unlock(&fil_system.mutex);
6103-
if (space) {
6104-
*success = xb_space_create_file(real_name, info.space_id,
6105-
flags, &file);
6106-
} else {
6107-
msg("Can't create tablespace %s\n", dest_space_name);
6108-
}
6103+
*success = xb_space_create_file(real_name, info.space_id,
6104+
flags, &file);
61096105

61106106
goto exit;
61116107
}

include/ilist.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ template <class T, class Tag= void> class ilist
189189
ListNode *prev= pos.node_->prev;
190190
ListNode *next= pos.node_->next;
191191

192+
DBUG_ASSERT(prev->next == pos.node_);
193+
DBUG_ASSERT(next->prev == pos.node_);
194+
192195
prev->next= next;
193196
next->prev= prev;
194197

@@ -202,7 +205,7 @@ template <class T, class Tag= void> class ilist
202205
}
203206

204207
void push_back(reference value) noexcept { insert(end(), value); }
205-
void pop_back() noexcept { erase(end()); }
208+
void pop_back() noexcept { erase(--end()); }
206209

207210
void push_front(reference value) noexcept { insert(begin(), value); }
208211
void pop_front() noexcept { erase(begin()); }

mysql-test/suite/innodb/r/alter_crash.result

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,26 @@ SELECT * FROM t1;
220220
a b
221221
1 1
222222
2 1
223+
connect ddl, localhost, root;
224+
SET DEBUG_SYNC = 'fil_ibd_create_logged SIGNAL stuck WAIT_FOR ever';
225+
ALTER TABLE t1 FORCE;
226+
connection default;
227+
SET DEBUG_SYNC = 'now WAIT_FOR stuck';
228+
# Kill the server
229+
disconnect ddl;
230+
# restart
231+
CHECK TABLE t1;
232+
Table Op Msg_type Msg_text
233+
test.t1 check status OK
234+
SHOW CREATE TABLE t1;
235+
Table Create Table
236+
t1 CREATE TABLE `t1` (
237+
`a` int(11) NOT NULL,
238+
`b` int(11) DEFAULT NULL,
239+
PRIMARY KEY (`a`)
240+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
241+
SELECT * FROM t1;
242+
a b
243+
1 1
244+
2 1
223245
DROP TABLE t1;

mysql-test/suite/innodb/r/alter_kill.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ BEGIN;
3636
INSERT INTO t1 VALUES(42);
3737
connect con1,localhost,root;
3838
CREATE TABLE bug16735660 (a INT PRIMARY KEY) ENGINE=InnoDB;
39+
SET GLOBAL innodb_max_purge_lag_wait=2;
40+
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
41+
SET GLOBAL innodb_max_dirty_pages_pct=0.0;
42+
SET GLOBAL innodb_max_dirty_pages_pct=90.0;
3943
XA START 'x';
4044
INSERT INTO bug16735660 VALUES(1),(2),(3);
4145
XA END 'x';

mysql-test/suite/innodb/r/innodb-index.result

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,16 +1920,10 @@ CREATE TABLE t2(f1 INT PRIMARY KEY)ENGINE=InnoDB;
19201920
# Kill the server
19211921
# Wrong space_id in a dirty file and a missing file
19221922
# restart
1923-
SELECT * FROM INFORMATION_SCHEMA.ENGINES
1924-
WHERE engine = 'innodb'
1925-
AND support IN ('YES', 'DEFAULT', 'ENABLED');
1926-
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
1927-
# Restore t1 and t2
1928-
# restart
1929-
SELECT * FROM t1;
1930-
f1
1931-
SELECT * FROM t2;
1932-
f1
1923+
CHECK TABLE t1, t2;
1924+
Table Op Msg_type Msg_text
1925+
test.t1 check status OK
1926+
test.t2 check status OK
19331927
DROP TABLE t1, t2;
19341928
#
19351929
# MDEV-18186 assertion failure on missing InnoDB index

mysql-test/suite/innodb/r/log_file_name.result

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,6 @@ WHERE engine = 'innodb'
1919
AND support IN ('YES', 'DEFAULT', 'ENABLED');
2020
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
2121
FOUND 1 /InnoDB: Ignoring data file '.*t2.ibd' with space ID \d+. Another data file called .*t1.ibd exists with the same space ID/ in mysqld.1.err
22-
# Fault 2: Wrong space_id in a dirty file, and a missing file.
23-
# restart
24-
SELECT * FROM INFORMATION_SCHEMA.ENGINES
25-
WHERE engine = 'innodb'
26-
AND support IN ('YES', 'DEFAULT', 'ENABLED');
27-
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
28-
FOUND 1 /InnoDB: Tablespace \d+ was not found at.*t3.ibd/ in mysqld.1.err
29-
# Fault 3: Wrong space_id in a dirty file, and no missing file.
30-
# restart
31-
SELECT * FROM INFORMATION_SCHEMA.ENGINES
32-
WHERE engine = 'innodb'
33-
AND support IN ('YES', 'DEFAULT', 'ENABLED');
34-
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
35-
FOUND 1 /InnoDB: Ignoring data file '.*t[23].ibd' with space ID/ in mysqld.1.err
36-
NOT FOUND /InnoDB: Tablespace \d+ was not found at .*t1.ibd/ in mysqld.1.err
37-
FOUND 1 /InnoDB: Tablespace \d+ was not found at .*t3.ibd/ in mysqld.1.err
38-
FOUND 2 /InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace/ in mysqld.1.err
3922
# Fault 4: Missing data file
4023
# restart
4124
SELECT * FROM INFORMATION_SCHEMA.ENGINES
@@ -57,6 +40,7 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
5740
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
5841
NOT FOUND /\[Note\] InnoDB: Cannot read first page of .*t2.ibd/ in mysqld.1.err
5942
FOUND 1 /.*\[ERROR\] InnoDB: Cannot apply log to \[page id: space=[1-9][0-9]*, page number=3\] of corrupted file './test/t2\.ibd'/ in mysqld.1.err
43+
# Fault 2: Wrong space_id in a dirty file, and a missing file.
6044
# restart
6145
SELECT * FROM t2;
6246
a
@@ -78,6 +62,16 @@ CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
7862
ERROR HY000: Can't create table `test`.`t0` (errno: 184 "Tablespace already exists")
7963
CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
8064
DROP TABLE t0;
65+
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
66+
ERROR HY000: Can't create table `test`.`t1` (errno: 184 "Tablespace already exists")
67+
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
68+
ERROR HY000: Can't create table `test`.`t1` (errno: 184 "Tablespace already exists")
69+
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
70+
DROP TABLE t1;
71+
SET GLOBAL innodb_max_purge_lag_wait=0;
72+
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
73+
SET GLOBAL innodb_max_dirty_pages_pct=0.0;
74+
SET GLOBAL innodb_max_dirty_pages_pct=90.0;
8175
CREATE TABLE u1(a INT PRIMARY KEY) ENGINE=InnoDB;
8276
CREATE TABLE u2(a INT PRIMARY KEY) ENGINE=InnoDB;
8377
CREATE TABLE u3(a INT PRIMARY KEY) ENGINE=InnoDB;

mysql-test/suite/innodb/t/alter_crash.test

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,20 @@ SET GLOBAL innodb_fil_make_page_dirty_debug=0;
223223
disconnect ddl;
224224
--source include/start_mysqld.inc
225225

226+
CHECK TABLE t1;
227+
SHOW CREATE TABLE t1;
228+
SELECT * FROM t1;
229+
230+
connect ddl, localhost, root;
231+
SET DEBUG_SYNC = 'fil_ibd_create_logged SIGNAL stuck WAIT_FOR ever';
232+
send ALTER TABLE t1 FORCE;
233+
connection default;
234+
SET DEBUG_SYNC = 'now WAIT_FOR stuck';
235+
236+
--source include/kill_mysqld.inc
237+
disconnect ddl;
238+
--source include/start_mysqld.inc
239+
226240
CHECK TABLE t1;
227241
SHOW CREATE TABLE t1;
228242
SELECT * FROM t1;

mysql-test/suite/innodb/t/alter_kill.test

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ INSERT INTO t1 VALUES(42);
139139

140140
CREATE TABLE bug16735660 (a INT PRIMARY KEY) ENGINE=InnoDB;
141141

142+
# Force a log checkpoint to "discard" any FILE_CREATE records.
143+
SET GLOBAL innodb_max_purge_lag_wait=2;
144+
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
145+
SET GLOBAL innodb_max_dirty_pages_pct=0.0;
146+
let $wait_condition =
147+
SELECT variable_value = 0
148+
FROM information_schema.global_status
149+
WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY';
150+
--source include/wait_condition.inc
151+
SET GLOBAL innodb_max_dirty_pages_pct=90.0;
152+
142153
XA START 'x';
143154
--source ../include/no_checkpoint_start.inc
144155
INSERT INTO bug16735660 VALUES(1),(2),(3);

mysql-test/suite/innodb/t/innodb-index.test

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,29 +1132,13 @@ CREATE TABLE t2(f1 INT PRIMARY KEY)ENGINE=InnoDB;
11321132
--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1, t2;
11331133
--source include/no_checkpoint_end.inc
11341134

1135-
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
1136-
let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES
1137-
WHERE engine = 'innodb'
1138-
AND support IN ('YES', 'DEFAULT', 'ENABLED');
1139-
11401135
--echo # Wrong space_id in a dirty file and a missing file
1141-
1142-
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t0.ibd
11431136
--move_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t1.ibd
11441137

11451138
--source include/start_mysqld.inc
1146-
--eval $check_no_innodb
1147-
--source include/shutdown_mysqld.inc
1148-
1149-
--echo # Restore t1 and t2
1150-
1151-
--move_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd
1152-
--move_file $MYSQLD_DATADIR/test/t0.ibd $MYSQLD_DATADIR/test/t1.ibd
1153-
1154-
--source include/start_mysqld.inc
1155-
1156-
SELECT * FROM t1;
1157-
SELECT * FROM t2;
1139+
# Because the tables were created after the checkpoint,
1140+
# InnoDB will start up, but the tables will be corrupted.
1141+
CHECK TABLE t1, t2;
11581142

11591143
DROP TABLE t1, t2;
11601144

mysql-test/suite/innodb/t/log_file_name.test

Lines changed: 25 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -45,53 +45,13 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
4545
eval $check_no_innodb;
4646
let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t2.ibd' with space ID \d+. Another data file called .*t1.ibd exists with the same space ID;
4747
--source include/search_pattern_in_file.inc
48-
49-
--source include/shutdown_mysqld.inc
50-
51-
--remove_file $MYSQLD_DATADIR/test/t1.ibd
52-
53-
# This could fail to refuse InnoDB startup, in case there was a log
54-
# checkpoint after the CREATE TABLE t3. That is what we checked above.
55-
--echo # Fault 2: Wrong space_id in a dirty file, and a missing file.
56-
--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t1.ibd
57-
58-
--source include/start_mysqld.inc
59-
eval $check_no_innodb;
60-
61-
let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at.*t3.ibd;
62-
--source include/search_pattern_in_file.inc
63-
6448
--source include/shutdown_mysqld.inc
6549

66-
--move_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t3.ibd
67-
68-
--echo # Fault 3: Wrong space_id in a dirty file, and no missing file.
69-
# Swap t2.ibd and t3.ibd.
70-
--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t.ibd
71-
--move_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t3.ibd
72-
--move_file $MYSQLD_DATADIR/test/t.ibd $MYSQLD_DATADIR/test/t2.ibd
73-
74-
--source include/start_mysqld.inc
75-
eval $check_no_innodb;
76-
77-
let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t[23].ibd' with space ID;
78-
--source include/search_pattern_in_file.inc
79-
80-
let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t1.ibd;
81-
--source include/search_pattern_in_file.inc
82-
let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t3.ibd;
83-
--source include/search_pattern_in_file.inc
84-
let SEARCH_PATTERN= InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace;
85-
--source include/search_pattern_in_file.inc
86-
87-
--source include/shutdown_mysqld.inc
88-
89-
# Swap back t3.ibd, but hide t2.ibd (which the redo log also knows as t1.ibd).
90-
--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t.ibd
91-
--move_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t3.ibd
92-
9350
--echo # Fault 4: Missing data file
9451

52+
--move_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t.ibd
53+
--remove_file $MYSQLD_DATADIR/test/t1.ibd
54+
9555
--source include/start_mysqld.inc
9656
eval $check_no_innodb;
9757
--source include/shutdown_mysqld.inc
@@ -108,15 +68,6 @@ let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd.
10868
eval $check_no_innodb;
10969
--source include/shutdown_mysqld.inc
11070

111-
# On Linux, lseek() would typically report EINVAL when invoked on a directory.
112-
# On other plaftorms as well as some GNU/Linux based environments, such as
113-
# a Ubuntu 22.04 based image on Amazon Web Services,
114-
# os_file_get_size() would succeed on a directory, and we would get another
115-
# error about inability to apply log to a corrupted page.
116-
117-
#--let SEARCH_PATTERN= InnoDB: Could not measure the size of single-table tablespace file '.*test/t2\\.ibd'
118-
#--source include/search_pattern_in_file.inc
119-
12071
--rmdir $MYSQLD_DATADIR/test/t2.ibd
12172

12273
# Create a short file.
@@ -136,6 +87,9 @@ let SEARCH_PATTERN= .*\[ERROR\] InnoDB: Cannot apply log to \\[page id: space=[1
13687
--remove_file $MYSQLD_DATADIR/test/t2.ibd
13788
--move_file $MYSQLD_DATADIR/test/t.ibd $MYSQLD_DATADIR/test/t2.ibd
13889

90+
--echo # Fault 2: Wrong space_id in a dirty file, and a missing file.
91+
--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t1.ibd
92+
13993
--source include/start_mysqld.inc
14094

14195
SELECT * FROM t2;
@@ -150,13 +104,20 @@ CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
150104
--remove_file $MYSQLD_DATADIR/test/t0.ibd
151105
CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
152106
DROP TABLE t0;
107+
--error ER_CANT_CREATE_TABLE
108+
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
109+
--error ER_CANT_CREATE_TABLE
110+
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
111+
--remove_file $MYSQLD_DATADIR/test/t1.ibd
112+
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
113+
DROP TABLE t1;
153114

154115
--disable_query_log
155116
# The following are for the orphan file t0.ibd or for the directory t2.ibd:
156117
call mtr.add_suppression("InnoDB: Operating system error number [0-9]* in a file operation");
157118
call mtr.add_suppression("InnoDB: Error number \\d+ means");
158119
call mtr.add_suppression("InnoDB: Cannot create file '.*t0.ibd'");
159-
call mtr.add_suppression("InnoDB: The file '.*t0\.ibd' already exists");
120+
call mtr.add_suppression("InnoDB: The file '.*t[01]\.ibd' already exists");
160121
call mtr.add_suppression("InnoDB: Cannot open datafile for read-write: '.*t2\.ibd'");
161122
call mtr.add_suppression("InnoDB: Could not measure the size of single-table tablespace file '.*test/t2\\.ibd'");
162123
# The following are for aborted startup without --innodb-force-recovery:
@@ -186,6 +147,17 @@ call mtr.add_suppression("InnoDB: Cannot read first page in datafile:");
186147
FLUSH TABLES;
187148
--enable_query_log
188149

150+
# Force a log checkpoint to "discard" any FILE_CREATE records.
151+
SET GLOBAL innodb_max_purge_lag_wait=0;
152+
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
153+
SET GLOBAL innodb_max_dirty_pages_pct=0.0;
154+
let $wait_condition =
155+
SELECT variable_value = 0
156+
FROM information_schema.global_status
157+
WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY';
158+
--source include/wait_condition.inc
159+
SET GLOBAL innodb_max_dirty_pages_pct=90.0;
160+
189161
--source include/no_checkpoint_start.inc
190162

191163
CREATE TABLE u1(a INT PRIMARY KEY) ENGINE=InnoDB;

0 commit comments

Comments
 (0)