| 1 |
# |
| 2 |
# SYSTEM_VERSIONING_ASOF sysvar |
| 3 |
# |
| 4 |
create table t (a int) with system versioning; |
| 5 |
set @before= UNIX_TIMESTAMP(now(6)); |
| 6 |
insert into t values (1); |
| 7 |
set @after= UNIX_TIMESTAMP(now(6)); |
| 8 |
update t set a= 2; |
| 9 |
set global system_versioning_asof= FROM_UNIXTIME(@after); |
| 10 |
set system_versioning_asof= FROM_UNIXTIME(@after); |
| 11 |
select * from t as nonempty; |
| 12 |
a |
| 13 |
1 |
| 14 |
connect subcon,127.0.0.1,root,,,$SERVER_MYPORT_1; |
| 15 |
connection subcon; |
| 16 |
select * from t as nonempty; |
| 17 |
a |
| 18 |
1 |
| 19 |
disconnect subcon; |
| 20 |
connection default; |
| 21 |
set global system_versioning_asof= FROM_UNIXTIME(@before); |
| 22 |
select * from t as nonempty; |
| 23 |
a |
| 24 |
1 |
| 25 |
connect subcon,127.0.0.1,root,,,$SERVER_MYPORT_1; |
| 26 |
connection subcon; |
| 27 |
select * from t as empty; |
| 28 |
a |
| 29 |
disconnect subcon; |
| 30 |
connection default; |
| 31 |
drop table t; |
| 32 |
set global system_versioning_asof= DEFAULT; |
| 33 |
set system_versioning_asof= DEFAULT; |
| 34 |
# |
| 35 |
# DELETE HISTORY and privileges |
| 36 |
# |
| 37 |
connect root,localhost,root,,test; |
| 38 |
connection root; |
| 39 |
create database mysqltest; |
| 40 |
create user mysqltest_1@localhost; |
| 41 |
connect user1,localhost,mysqltest_1,,"*NO-ONE*"; |
| 42 |
connection user1; |
| 43 |
connection root; |
| 44 |
create table mysqltest.t (a int) with system versioning; |
| 45 |
connection user1; |
| 46 |
show grants; |
| 47 |
Grants for mysqltest_1@localhost |
| 48 |
GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` |
| 49 |
delete history from mysqltest.t before system_time now(); |
| 50 |
ERROR 42000: DELETE HISTORY command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`t` |
| 51 |
connection root; |
| 52 |
grant delete history on mysqltest.* to mysqltest_1@localhost; |
| 53 |
grant delete history on mysqltest.t to mysqltest_1@localhost; |
| 54 |
connection user1; |
| 55 |
show grants; |
| 56 |
Grants for mysqltest_1@localhost |
| 57 |
GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` |
| 58 |
GRANT DELETE HISTORY ON `mysqltest`.* TO `mysqltest_1`@`localhost` |
| 59 |
GRANT DELETE HISTORY ON `mysqltest`.`t` TO `mysqltest_1`@`localhost` |
| 60 |
delete history from mysqltest.t before system_time now(); |
| 61 |
connection root; |
| 62 |
grant all on *.* to mysqltest_1@localhost; |
| 63 |
show grants for mysqltest_1@localhost; |
| 64 |
Grants for mysqltest_1@localhost |
| 65 |
GRANT ALL PRIVILEGES ON *.* TO `mysqltest_1`@`localhost` |
| 66 |
GRANT DELETE HISTORY ON `mysqltest`.* TO `mysqltest_1`@`localhost` |
| 67 |
GRANT DELETE HISTORY ON `mysqltest`.`t` TO `mysqltest_1`@`localhost` |
| 68 |
drop user mysqltest_1@localhost; |
| 69 |
drop database mysqltest; |
| 70 |
disconnect user1; |
| 71 |
disconnect root; |
| 72 |
connection default; |
| 73 |
# |
| 74 |
# MDEV-25559 Auto-create: infinite loop after interrupted lock wait |
| 75 |
# |
| 76 |
set timestamp= unix_timestamp('2000-01-01 00:00:00'); |
| 77 |
create table t (pk int primary key, a int) engine innodb with system versioning |
| 78 |
partition by system_time interval 1 hour auto; |
| 79 |
insert into t values (1, 0); |
| 80 |
begin; |
| 81 |
update t set a= a + 1; |
| 82 |
connect con1,localhost,root,,; |
| 83 |
set max_statement_time= 1; |
| 84 |
set timestamp= unix_timestamp('2000-01-01 01:00:00'); |
| 85 |
update t set a= a + 2; |
| 86 |
connection default; |
| 87 |
set timestamp= unix_timestamp('2000-01-01 01:00:00'); |
| 88 |
update t set a= a + 3; |
| 89 |
connection con1; |
| 90 |
ERROR 70100: Query execution was interrupted (max_statement_time exceeded) |
| 91 |
disconnect con1; |
| 92 |
connection default; |
| 93 |
commit; |
| 94 |
drop table t; |
| 95 |
set timestamp= default; |