1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '10.6' into 10.11

This commit is contained in:
Oleksandr Byelkin
2025-04-21 11:23:11 +02:00
40 changed files with 446 additions and 115 deletions

View File

@@ -86,6 +86,8 @@ delete from t where a =13;
DROP INDEX idx1 ON t;
DROP INDEX idx2 ON t;
DROP TABLE t;
# restart
set default_storage_engine=innodb;
/* Test large BLOB data */
CREATE TABLE `t` (
`a` BLOB,

View File

@@ -1,6 +1,6 @@
--source include/have_innodb.inc
--source include/have_partition.inc
--source include/big_test.inc
--source include/not_embedded.inc
call mtr.add_suppression("\\[Warning\\] InnoDB: Compute virtual");
@@ -66,6 +66,41 @@ DROP INDEX idx1 ON t;
DROP INDEX idx2 ON t;
DROP TABLE t;
let MYSQLD_DATADIR=`select @@datadir`;
let PAGE_SIZE=`select @@innodb_page_size`;
--source include/shutdown_mysqld.inc
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
my $file = "$ENV{MYSQLD_DATADIR}/ibdata1";
open(FILE, "+<$file") || die "Unable to open $file";
binmode FILE;
my $ps= $ENV{PAGE_SIZE};
my $page;
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
my $full_crc32 = unpack("N",substr($page,54,4)) & 0x10; # FIL_SPACE_FLAGS
sysseek(FILE, 7*$ps, 0) || die "Unable to seek $file\n";
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
substr($page,54,4)=pack("N",0xc001cafe); # 32 MSB of 64-bit DICT_HDR_INDEX_ID
my $polynomial = 0x82f63b78; # CRC-32C
if ($full_crc32)
{
my $ck = mycrc32(substr($page, 0, $ps-4), 0, $polynomial);
substr($page, $ps-4, 4) = pack("N", $ck);
}
else
{
my $ck= pack("N",mycrc32(substr($page, 4, 22), 0, $polynomial) ^
mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial));
substr($page,0,4)=$ck;
substr($page,$ps-8,4)=$ck;
}
sysseek(FILE, 7*$ps, 0) || die "Unable to rewind $file\n";
syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
close(FILE) || die "Unable to close $file";
EOF
--source include/start_mysqld.inc
set default_storage_engine=innodb;
/* Test large BLOB data */
CREATE TABLE `t` (
`a` BLOB,

View File

@@ -20,6 +20,9 @@ set global server_audit_file_path=null;
set global server_audit_incl_users=null;
set global server_audit_file_path='server_audit.log';
set global server_audit_output_type=file;
set global server_audit_file_path=REPEAT(REPEAT('new_file_name', 50), 50);
Warnings:
Warning 1 server_audit_file_path can't exceed FN_LEN characters.
set global server_audit_logging=on;
set global server_audit_incl_users= repeat("'root',", 10000);
ERROR 42000: Variable 'server_audit_incl_users' can't be set to the value of ''root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','...'

View File

@@ -20,6 +20,10 @@ set global server_audit_file_path=null;
set global server_audit_incl_users=null;
set global server_audit_file_path='server_audit.log';
set global server_audit_output_type=file;
--replace_regex /[1-9][0-9][0-9]+/FN_LEN/
set global server_audit_file_path=REPEAT(REPEAT('new_file_name', 50), 50);
set global server_audit_logging=on;
--error ER_WRONG_VALUE_FOR_VAR

View File

@@ -0,0 +1,41 @@
# Set up Semi-Sync with rpl_semi_sync_master_wait_no_slave=0
include/master-slave.inc
[connection master]
SET @@GLOBAL.rpl_semi_sync_master_enabled= 1;
SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0;
connection slave;
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1;
include/start_slave.inc
connection master;
connection slave;
connection master;
SELECT ID INTO @binlog_dump_tid
FROM information_schema.PROCESSLIST WHERE COMMAND = 'Binlog Dump';
# Control State
SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
STATE
Master has sent all binlog to slave; waiting for more updates
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
Variable_name Value
Rpl_semi_sync_master_clients 1
# Disable Semi-Sync while the dump thread is still connected to its slave
SET @@GLOBAL.rpl_semi_sync_master_enabled = 0;
SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
STATE
Master has sent all binlog to slave; waiting for more updates
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
Variable_name Value
Rpl_semi_sync_master_clients 1
# Disconnect the slave and wait until the master's dump thread is gone
connection slave;
STOP SLAVE;
connection master;
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
Variable_name Value
Rpl_semi_sync_master_clients 0
# Cleanup
SET @@GLOBAL.rpl_semi_sync_master_enabled= 0;
SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 1;
connection slave;
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0;
include/rpl_end.inc

View File

@@ -0,0 +1,68 @@
# MDEV-36359: Master crashes when reverting to async after Semi-Sync disabled.
#
# Assert behavior of turning Semi-Sync off on
# the master when still connected to a slave
--source include/have_binlog_format_mixed.inc # format-agnostic
--echo # Set up Semi-Sync with rpl_semi_sync_master_wait_no_slave=0
--let $rpl_skip_start_slave= 1
--source include/master-slave.inc
--let $orig_master_enabled=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled`
SET @@GLOBAL.rpl_semi_sync_master_enabled= 1;
--let $orig_wait_no_slave=`SELECT @@GLOBAL.rpl_semi_sync_master_wait_no_slave`
SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0;
--connection slave
--let $orig_slave_enabled=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled`
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1;
--source include/start_slave.inc
--connection master
# Make sure Semi-Sync is active
--let $status_var= Rpl_semi_sync_master_status
--let $status_var_value= ON
--source include/wait_for_status_var.inc
--sync_slave_with_master
--connection master
--disable_cursor_protocol
SELECT ID INTO @binlog_dump_tid
FROM information_schema.PROCESSLIST WHERE COMMAND = 'Binlog Dump';
--enable_cursor_protocol
--echo # Control State
SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
--echo # Disable Semi-Sync while the dump thread is still connected to its slave
SET @@GLOBAL.rpl_semi_sync_master_enabled = 0;
--let $status_var_value= OFF
--source include/wait_for_status_var.inc
SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
--echo # Disconnect the slave and wait until the master's dump thread is gone
--connection slave
STOP SLAVE;
# Starting with MDEV-13073,
# Semi-Sync STOP SLAVE also terminates its dump thread on the master.
--connection master
# MDEV-36359: The disconnection would crash the master and leave the wait with
# error 2013 'Lost connection to server during query'
--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid
--source include/wait_condition.inc
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
--echo # Cleanup
--eval SET @@GLOBAL.rpl_semi_sync_master_enabled= $orig_master_enabled
--eval SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= $orig_wait_no_slave
--connection slave
--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= $orig_slave_enabled
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc

View File

@@ -47,14 +47,57 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si
11 1 9223372036854775806 1 1 1000 0 0
connection only_alter;
select next value for s1;
ERROR 42000: INSERT command denied to user 'only_alter'@'localhost' for table `mysqltest_1`.`s1`
ERROR 42000: SELECT, INSERT command denied to user 'only_alter'@'localhost' for table `mysqltest_1`.`s1`
alter sequence s1 restart= 11;
select * from s1;
ERROR 42000: SELECT command denied to user 'only_alter'@'localhost' for table `mysqltest_1`.`s1`
connection default;
drop database mysqltest_1;
drop user 'normal'@'%';
drop user 'read_only'@'%';
drop user 'read_write'@'%';
drop user 'alter'@'%';
drop user 'only_alter'@'%';
drop sequence s1;
#
# MDEV-36413 User without any privileges to a sequence can read from
# it and modify it via column default
#
create sequence s1;
create sequence s2;
select * from s2;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
create table t2 (a int not null default(nextval(s1)));
insert into t2 values();
create user u;
grant create, insert, select, drop on mysqltest_1.t1 to u;
grant insert, select on mysqltest_1.s1 to u;
grant select on mysqltest_1.t2 to u;
connect con1,localhost,u,,mysqltest_1;
select nextval(s2);
ERROR 42000: SELECT, INSERT command denied to user 'u'@'localhost' for table `mysqltest_1`.`s2`
show create sequence s2;
ERROR 42000: SHOW command denied to user 'u'@'localhost' for table `mysqltest_1`.`s2`
create table t1 (a int not null default(nextval(s1)));
drop table t1;
create table t1 (a int not null default(nextval(s1))) select a from t2;
insert into t1 values();
select * from t1;
a
1
2
drop table t1;
create table t1 (a int not null default(nextval(s1))) select a from (select t2.a from t2,t2 as t3 where t2.a=t3.a) as t4;
drop table t1;
create table t1 (a int not null default(nextval(s2)));
ERROR 42000: SELECT, INSERT command denied to user 'u'@'localhost' for table `mysqltest_1`.`s2`
create table t1 (a int not null default(nextval(s1)),
b int not null default(nextval(s2)));
ERROR 42000: SELECT, INSERT command denied to user 'u'@'localhost' for table `mysqltest_1`.`s2`
disconnect con1;
connection default;
drop user u;
drop database mysqltest_1;
#
# End of 10.11 tests
#

View File

@@ -60,10 +60,58 @@ select * from s1;
#
connection default;
drop database mysqltest_1;
drop user 'normal'@'%';
drop user 'read_only'@'%';
drop user 'read_write'@'%';
drop user 'alter'@'%';
drop user 'only_alter'@'%';
drop sequence s1;
--echo #
--echo # MDEV-36413 User without any privileges to a sequence can read from
--echo # it and modify it via column default
--echo #
create sequence s1;
create sequence s2;
select * from s2;
create table t2 (a int not null default(nextval(s1)));
insert into t2 values();
create user u;
grant create, insert, select, drop on mysqltest_1.t1 to u;
grant insert, select on mysqltest_1.s1 to u;
grant select on mysqltest_1.t2 to u;
--connect(con1,localhost,u,,mysqltest_1)
--error ER_TABLEACCESS_DENIED_ERROR
select nextval(s2);
--error ER_TABLEACCESS_DENIED_ERROR
show create sequence s2;
create table t1 (a int not null default(nextval(s1)));
drop table t1;
create table t1 (a int not null default(nextval(s1))) select a from t2;
insert into t1 values();
select * from t1;
drop table t1;
create table t1 (a int not null default(nextval(s1))) select a from (select t2.a from t2,t2 as t3 where t2.a=t3.a) as t4;
drop table t1;
--error ER_TABLEACCESS_DENIED_ERROR
create table t1 (a int not null default(nextval(s2)));
--error ER_TABLEACCESS_DENIED_ERROR
create table t1 (a int not null default(nextval(s1)),
b int not null default(nextval(s2)));
--disconnect con1
--connection default
drop user u;
#
# Cleanup
#
drop database mysqltest_1;
--echo #
--echo # End of 10.11 tests
--echo #

View File

@@ -174,7 +174,7 @@ create sequence s_db.s2;
drop sequence s_db.s2;
connection m_normal_2;
select next value for s_db.s1;
ERROR 42000: INSERT command denied to user 'normal_2'@'localhost' for table `s_db`.`s1`
ERROR 42000: SELECT, INSERT command denied to user 'normal_2'@'localhost' for table `s_db`.`s1`
create sequence s_db.s2;
ERROR 42000: CREATE command denied to user 'normal_2'@'localhost' for table `s_db`.`s2`
connection m_normal_1;

View File

@@ -285,7 +285,7 @@ create sequence s_db.s2;
drop sequence s_db.s2;
connection m_normal_2;
select NEXT VALUE for s_db.s1;
ERROR 42000: INSERT command denied to user 'normal_2'@'localhost' for table `s_db`.`s1`
ERROR 42000: SELECT, INSERT command denied to user 'normal_2'@'localhost' for table `s_db`.`s1`
create sequence s_db.s2;
ERROR 42000: CREATE command denied to user 'normal_2'@'localhost' for table `s_db`.`s2`
connection m_normal_1;

View File

@@ -1,5 +1,4 @@
--source include/have_sequence.inc
--source include/have_innodb.inc
#
# Test sequences with views