Debian Codegraph @

mysql-test/suite/versioning/t/not_embedded.test

raw
1 --source include/not_embedded.inc
2 --source include/have_innodb.inc
3 --source include/have_partition.inc
4
5 --echo #
6 --echo # SYSTEM_VERSIONING_ASOF sysvar
7 --echo #
8 create table t (a int) with system versioning;
9 set @before= UNIX_TIMESTAMP(now(6));
10 insert into t values (1);
11 set @after= UNIX_TIMESTAMP(now(6));
12 update t set a= 2;
13
14 set global system_versioning_asof= FROM_UNIXTIME(@after);
15 set system_versioning_asof= FROM_UNIXTIME(@after);
16 select * from t as nonempty;
17
18 --connect (subcon,127.0.0.1,root,,,$SERVER_MYPORT_1)
19 --connection subcon
20 select * from t as nonempty;
21 --disconnect subcon
22 --connection default
23
24 set global system_versioning_asof= FROM_UNIXTIME(@before);
25 select * from t as nonempty;
26
27 --connect (subcon,127.0.0.1,root,,,$SERVER_MYPORT_1)
28 --connection subcon
29 select * from t as empty;
30 --disconnect subcon
31 --connection default
32
33 drop table t;
34
35 set global system_versioning_asof= DEFAULT;
36 set system_versioning_asof= DEFAULT;
37
38 --echo #
39 --echo # DELETE HISTORY and privileges
40 --echo #
41
42 # Save the initial number of concurrent sessions
43 --source include/count_sessions.inc
44
45 connect (root,localhost,root,,test);
46 connection root;
47
48 --disable_warnings
49 create database mysqltest;
50 --enable_warnings
51
52 create user mysqltest_1@localhost;
53 connect (user1,localhost,mysqltest_1,,"*NO-ONE*");
54 connection user1;
55
56 connection root;
57 create table mysqltest.t (a int) with system versioning;
58
59 connection user1;
60 show grants;
61 --error ER_TABLEACCESS_DENIED_ERROR
62 delete history from mysqltest.t before system_time now();
63
64 connection root;
65 grant delete history on mysqltest.* to mysqltest_1@localhost;
66 grant delete history on mysqltest.t to mysqltest_1@localhost;
67
68 connection user1;
69 show grants;
70 delete history from mysqltest.t before system_time now();
71
72 connection root;
73 grant all on *.* to mysqltest_1@localhost;
74 show grants for mysqltest_1@localhost;
75
76 drop user mysqltest_1@localhost;
77 drop database mysqltest;
78 --disconnect user1
79 --disconnect root
80 --connection default
81
82 --echo #
83 --echo # MDEV-25559 Auto-create: infinite loop after interrupted lock wait
84 --echo #
85
86 set timestamp= unix_timestamp('2000-01-01 00:00:00');
87 create table t (pk int primary key, a int) engine innodb with system versioning
88 partition by system_time interval 1 hour auto;
89 insert into t values (1, 0);
90 begin;
91 update t set a= a + 1;
92 --connect (con1,localhost,root,,)
93 set max_statement_time= 1;
94 set timestamp= unix_timestamp('2000-01-01 01:00:00');
95 send update t set a= a + 2;
96 --connection default
97 set timestamp= unix_timestamp('2000-01-01 01:00:00');
98 send update t set a= a + 3;
99 --connection con1
100 --error ER_STATEMENT_TIMEOUT
101 reap;
102 --disconnect con1
103 --connection default
104 reap;
105 commit;
106 drop table t;
107 set timestamp= default;