Skip to content

Commit

Permalink
Merge 10.5 into 10.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Oct 19, 2023
2 parents bf7c6fc + 85751ed commit 6991b1c
Show file tree
Hide file tree
Showing 38 changed files with 858 additions and 643 deletions.
32 changes: 20 additions & 12 deletions extra/mariabackup/xtrabackup.cc
Expand Up @@ -4539,16 +4539,24 @@ bool Backup_datasinks::backup_low()

if (recv_find_max_checkpoint(&max_cp_field) == DB_SUCCESS
&& log_sys.log.format != 0) {
if (max_cp_field == LOG_CHECKPOINT_1) {
log_sys.log.read(max_cp_field,
{log_sys.checkpoint_buf,
OS_FILE_LOG_BLOCK_SIZE});
switch (max_cp_field) {
case LOG_CHECKPOINT_1:
if (log_sys.log.read(max_cp_field,
{log_sys.checkpoint_buf,
OS_FILE_LOG_BLOCK_SIZE}))
{
/* metadata_to_lsn still 0 so error returns below */
msg("Error: recv_find_max_checkpoint() failed.");
break;
}
/* fallthrough */
default:
metadata_to_lsn = mach_read_from_8(
log_sys.checkpoint_buf + LOG_CHECKPOINT_LSN);
msg("mariabackup: The latest check point"
" (for incremental): '" LSN_PF "'",
metadata_to_lsn);
}
metadata_to_lsn = mach_read_from_8(
log_sys.checkpoint_buf + LOG_CHECKPOINT_LSN);
msg("mariabackup: The latest check point"
" (for incremental): '" LSN_PF "'",
metadata_to_lsn);
} else {
msg("Error: recv_find_max_checkpoint() failed.");
}
Expand Down Expand Up @@ -4771,14 +4779,14 @@ static bool xtrabackup_backup_func()
checkpoint_lsn_start = log_sys.log.get_lsn();
checkpoint_no_start = log_sys.next_checkpoint_no;

log_sys.log.read(max_cp_field, {buf, OS_FILE_LOG_BLOCK_SIZE});
err = log_sys.log.read(max_cp_field, {buf, OS_FILE_LOG_BLOCK_SIZE});

if (checkpoint_no_start
if (err == DB_SUCCESS && (checkpoint_no_start
!= mach_read_from_8(buf + LOG_CHECKPOINT_NO)
|| checkpoint_lsn_start
!= mach_read_from_8(buf + LOG_CHECKPOINT_LSN)
|| log_sys.log.get_lsn_offset()
!= mach_read_from_8(buf + LOG_CHECKPOINT_OFFSET))
!= mach_read_from_8(buf + LOG_CHECKPOINT_OFFSET)))
goto reread_log_header;
}
mysql_mutex_unlock(&log_sys.mutex);
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/include/maria_empty_logs.inc
Expand Up @@ -11,6 +11,7 @@
connection default;
let $default_db=`select database()`;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
let $pid_file=`select @@pid_file`;

#it will used at end of test for wait_for_status_var.inc primitive
#let $status_var= Threads_connected;
Expand All @@ -23,6 +24,7 @@ wait-maria_empty_logs.inc
EOF

--source include/mysqladmin_shutdown.inc
--source include/wait_until_no_pidfile.inc

--disable_warnings
if (!$mel_keep_control_file)
Expand Down
30 changes: 30 additions & 0 deletions mysql-test/include/wait_until_no_pidfile.inc
@@ -0,0 +1,30 @@
# Include this script after a shutdown to wait until the pid file,
# stored in $pid_file, has disappered.

#--echo $pid_file

--disable_result_log
--disable_query_log
# Wait one minute
let $counter= 600;
while ($counter)
{
--error 0,1
--file_exists $pid_file
if (!$errno)
{
dec $counter;
--real_sleep 0.1
}
if ($errno)
{
let $counter= 0;
}
}
if (!$errno)
{
--die Pid file "$pid_file" failed to disappear
}

--enable_query_log
--enable_result_log
2 changes: 2 additions & 0 deletions mysql-test/main/log_slow.test
Expand Up @@ -141,6 +141,7 @@ CREATE TABLE `tab_MDEV_30820` (
);

--disable_ps2_protocol
--disable_view_protocol

--delimiter //
CREATE FUNCTION `get_zero`() RETURNS int(11)
Expand Down Expand Up @@ -182,6 +183,7 @@ drop table tab_MDEV_30820, tab2;
drop function get_zero;

--enable_ps2_protocol
--enable_view_protocol

--echo #
--echo # End of 10.4 tests
Expand Down
17 changes: 7 additions & 10 deletions mysql-test/main/order_by_optimizer_innodb.result
Expand Up @@ -3,10 +3,6 @@ SET GLOBAL innodb_stats_persistent=OFF;
#
# MDEV-6402: Optimizer doesn't choose best execution plan when composite key is used
#
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
CREATE TABLE t2 (
pk1 int(11) NOT NULL,
pk2 int(11) NOT NULL,
Expand All @@ -18,13 +14,13 @@ UNIQUE KEY ux_pk1_fd5 (pk1,fd5)
) ENGINE=InnoDB;
insert into t2
select
round(log(2,t1.a+1)),
t1.a,
t1.a,
round(log(2,seq+1)),
seq,
seq,
REPEAT('filler-data-', 10),
REPEAT('filler-data-', 10)
from
t1;
seq_0_to_1999;
select pk1, count(*) from t2 group by pk1;
pk1 count(*)
0 1
Expand All @@ -37,7 +33,8 @@ pk1 count(*)
7 91
8 181
9 362
10 276
10 724
11 552
# The following should use range(ux_pk1_fd5), two key parts (key_len=5+8=13)
EXPLAIN SELECT * FROM t2 USE INDEX(ux_pk1_fd5) WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10;
id select_type table type possible_keys key key_len ref rows Extra
Expand All @@ -46,7 +43,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t2 WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range PRIMARY,ux_pk1_fd5 ux_pk1_fd5 13 NULL 138 Using where
drop table t0,t1, t2;
drop table t2;
#
# MDEV-6814: Server crashes in calculate_key_len on query with ORDER BY
#
Expand Down
16 changes: 6 additions & 10 deletions mysql-test/main/order_by_optimizer_innodb.test
@@ -1,16 +1,12 @@
--source include/have_innodb.inc
--source include/have_sequence.inc

SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=OFF;

--echo #
--echo # MDEV-6402: Optimizer doesn't choose best execution plan when composite key is used
--echo #
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;

CREATE TABLE t2 (
pk1 int(11) NOT NULL,
Expand All @@ -24,13 +20,13 @@ CREATE TABLE t2 (

insert into t2
select
round(log(2,t1.a+1)),
t1.a,
t1.a,
round(log(2,seq+1)),
seq,
seq,
REPEAT('filler-data-', 10),
REPEAT('filler-data-', 10)
from
t1;
seq_0_to_1999;

select pk1, count(*) from t2 group by pk1;

Expand All @@ -39,7 +35,7 @@ EXPLAIN SELECT * FROM t2 USE INDEX(ux_pk1_fd5) WHERE pk1=9 AND fd5 < 500 ORDER B
--echo # This also must use range, not ref. key_len must be 13
EXPLAIN SELECT * FROM t2 WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10;

drop table t0,t1, t2;
drop table t2;

--echo #
--echo # MDEV-6814: Server crashes in calculate_key_len on query with ORDER BY
Expand Down
21 changes: 21 additions & 0 deletions mysql-test/suite/innodb/r/undo_space_dblwr.result
@@ -0,0 +1,21 @@
call mtr.add_suppression("Checksum mismatch in the first page of file");
show variables like 'innodb_doublewrite';
Variable_name Value
innodb_doublewrite ON
create table t1(f1 int not null, f2 int not null)engine=innodb;
insert into t1 values (1, 1);
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
InnoDB 0 transactions not purged
set GLOBAL innodb_log_checkpoint_now=1;
# Make the first page dirty for undo tablespace
set global innodb_saved_page_number_debug = 0;
set global innodb_fil_make_page_dirty_debug = 1;
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
SET GLOBAL innodb_max_dirty_pages_pct=0.0;
# Kill the server
# restart
FOUND 1 /Checksum mismatch in the first page of file/ in mysqld.1.err
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
2 changes: 2 additions & 0 deletions mysql-test/suite/innodb/t/undo_space_dblwr.opt
@@ -0,0 +1,2 @@
--innodb_undo_tablespaces=3
--innodb_sys_tablespaces
47 changes: 47 additions & 0 deletions mysql-test/suite/innodb/t/undo_space_dblwr.test
@@ -0,0 +1,47 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/not_embedded.inc
call mtr.add_suppression("Checksum mismatch in the first page of file");
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
let MYSQLD_DATADIR=`select @@datadir`;

show variables like 'innodb_doublewrite';
create table t1(f1 int not null, f2 int not null)engine=innodb;
insert into t1 values (1, 1);

SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
--source include/wait_all_purged.inc

set GLOBAL innodb_log_checkpoint_now=1;
--source ../include/no_checkpoint_start.inc

--echo # Make the first page dirty for undo tablespace
set global innodb_saved_page_number_debug = 0;
set global innodb_fil_make_page_dirty_debug = 1;

SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
SET GLOBAL innodb_max_dirty_pages_pct=0.0;

sleep 1;
--let CLEANUP_IF_CHECKPOINT=drop table t1;
--source ../include/no_checkpoint_end.inc

perl;
use IO::Handle;
my $fname= "$ENV{'MYSQLD_DATADIR'}/undo001";
my $page_size = $ENV{INNODB_PAGE_SIZE};
die unless open(FILE, "+<", $fname);
sysread(FILE, $page, $page_size)==$page_size||die "Unable to read $name\n";
substr($page, 49, 4) = pack("N", 1000);
sysseek(FILE, 0, 0)||die "Unable to seek $fname\n";
die unless syswrite(FILE, $page, $page_size) == $page_size;
close FILE;
EOF

--source include/start_mysqld.inc
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN= Checksum mismatch in the first page of file;
--source include/search_pattern_in_file.inc

check table t1;
drop table t1;
6 changes: 6 additions & 0 deletions mysql-test/suite/mariabackup/data_directory.result
Expand Up @@ -11,3 +11,9 @@ SELECT * FROM t;
a
1
DROP TABLE t;
#
# MDEV-18200 MariaBackup full backup failed with InnoDB: Failing assertion: success
#
#
# End of 10.4 tests
#
15 changes: 15 additions & 0 deletions mysql-test/suite/mariabackup/data_directory.test
Expand Up @@ -21,4 +21,19 @@ rmdir $table_data_dir;
SELECT * FROM t;
DROP TABLE t;
rmdir $targetdir;

--echo #
--echo # MDEV-18200 MariaBackup full backup failed with InnoDB: Failing assertion: success
--echo #
let $DATADIR= `select @@datadir`;
chmod 0000 $DATADIR/ibdata1;
--disable_result_log
--error 1
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
--enable_result_log
chmod 0755 $DATADIR/ibdata1;
rmdir $table_data_dir;
rmdir $targetdir;
--echo #
--echo # End of 10.4 tests
--echo #
Expand Up @@ -4,17 +4,6 @@

# Wait until there is only one session left, this one.

let $wait_condition=
select count(*) = 1 from information_schema.processlist;
--source include/wait_condition.inc

# Threads are removed from information_schema.processlist
# very soon, but continue to execute in the server,
# before finally be removed from performance_schema.threads.
# Because instrumentation is optional, we use "<=" here.

let $wait_condition=
select count(*) <= 2 from performance_schema.threads
where `TYPE`='FOREGROUND';
let $wait_condition= select count(*) = 1 from performance_schema.threads where `type`='foreground';
--source include/wait_condition.inc

This file was deleted.

0 comments on commit 6991b1c

Please sign in to comment.