mirror of
https://github.com/MariaDB/server.git
synced 2025-10-11 18:29:14 +02:00

Follow-up patch with adjustments of test files and updates of result files for tests. Some of tests were rewritten slighlty. Everywhere where common pattern used: ----- CREATE USER userA; --connect con1 ... userA ... <sql statements...> --disconnect con1 DROP USER userA; ----- the DROP USER statement has been eclosed into the directive --disable_warnings --enable_warnings This change is caused by the race conddition between --disconnect and DROP USER since a number of currently running sessions established on behalf the user being dropped is counted by holding the rw_lock THD_list_iterator::lock that is not acquired on execution the DROP USER statement but the lock is taken as the last step on handling disconnection (when the client is already sending the next statement). Therefore, for the cases where the command --disconnect precedes the DROP USER statement we hide the possible warnings about presence of active sessions for the user being deleted to make tests deterministic.
97 lines
3.1 KiB
Text
97 lines
3.1 KiB
Text
#
|
|
# SYSTEM_VERSIONING_ASOF sysvar
|
|
#
|
|
create table t (a int) with system versioning;
|
|
set @before= UNIX_TIMESTAMP(now(6));
|
|
insert into t values (1);
|
|
set @after= UNIX_TIMESTAMP(now(6));
|
|
update t set a= 2;
|
|
set global system_versioning_asof= FROM_UNIXTIME(@after);
|
|
set system_versioning_asof= FROM_UNIXTIME(@after);
|
|
select * from t as nonempty;
|
|
a
|
|
1
|
|
connect subcon,127.0.0.1,root,,,$SERVER_MYPORT_1;
|
|
connection subcon;
|
|
select * from t as nonempty;
|
|
a
|
|
1
|
|
disconnect subcon;
|
|
connection default;
|
|
set global system_versioning_asof= FROM_UNIXTIME(@before);
|
|
select * from t as nonempty;
|
|
a
|
|
1
|
|
connect subcon,127.0.0.1,root,,,$SERVER_MYPORT_1;
|
|
connection subcon;
|
|
select * from t as empty;
|
|
a
|
|
disconnect subcon;
|
|
connection default;
|
|
drop table t;
|
|
set global system_versioning_asof= DEFAULT;
|
|
set system_versioning_asof= DEFAULT;
|
|
#
|
|
# DELETE HISTORY and privileges
|
|
#
|
|
connect root,localhost,root,,test;
|
|
connection root;
|
|
create database mysqltest;
|
|
create user mysqltest_1@localhost;
|
|
connect user1,localhost,mysqltest_1,,"*NO-ONE*";
|
|
connection user1;
|
|
connection root;
|
|
create table mysqltest.t (a int) with system versioning;
|
|
connection user1;
|
|
show grants;
|
|
Grants for mysqltest_1@localhost
|
|
GRANT USAGE ON *.* TO `mysqltest_1`@`localhost`
|
|
delete history from mysqltest.t before system_time now();
|
|
ERROR 42000: DELETE HISTORY command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`t`
|
|
connection root;
|
|
grant delete history on mysqltest.* to mysqltest_1@localhost;
|
|
grant delete history on mysqltest.t to mysqltest_1@localhost;
|
|
connection user1;
|
|
show grants;
|
|
Grants for mysqltest_1@localhost
|
|
GRANT USAGE ON *.* TO `mysqltest_1`@`localhost`
|
|
GRANT DELETE HISTORY ON `mysqltest`.* TO `mysqltest_1`@`localhost`
|
|
GRANT DELETE HISTORY ON `mysqltest`.`t` TO `mysqltest_1`@`localhost`
|
|
delete history from mysqltest.t before system_time now();
|
|
connection root;
|
|
grant all on *.* to mysqltest_1@localhost;
|
|
show grants for mysqltest_1@localhost;
|
|
Grants for mysqltest_1@localhost
|
|
GRANT ALL PRIVILEGES ON *.* TO `mysqltest_1`@`localhost`
|
|
GRANT DELETE HISTORY ON `mysqltest`.* TO `mysqltest_1`@`localhost`
|
|
GRANT DELETE HISTORY ON `mysqltest`.`t` TO `mysqltest_1`@`localhost`
|
|
drop user mysqltest_1@localhost;
|
|
Warnings:
|
|
Note 4226 Dropped users ['mysqltest_1'@'localhost'] have active connections. Use KILL CONNECTION if they should not be used anymore.
|
|
drop database mysqltest;
|
|
disconnect user1;
|
|
disconnect root;
|
|
connection default;
|
|
#
|
|
# MDEV-25559 Auto-create: infinite loop after interrupted lock wait
|
|
#
|
|
set timestamp= unix_timestamp('2000-01-01 00:00:00');
|
|
create table t (pk int primary key, a int) engine innodb with system versioning
|
|
partition by system_time interval 1 hour auto;
|
|
insert into t values (1, 0);
|
|
begin;
|
|
update t set a= a + 1;
|
|
connect con1,localhost,root,,;
|
|
set max_statement_time= 1;
|
|
set timestamp= unix_timestamp('2000-01-01 01:00:00');
|
|
update t set a= a + 2;
|
|
connection default;
|
|
set timestamp= unix_timestamp('2000-01-01 01:00:00');
|
|
update t set a= a + 3;
|
|
connection con1;
|
|
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
|
|
disconnect con1;
|
|
connection default;
|
|
commit;
|
|
drop table t;
|
|
set timestamp= default;
|