Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,7 @@ drop database sub_database01;
drop database sub_database02;
drop database sub_database03;
drop database sub_database01;
Can't drop database 'sub_database01'; database doesn't exist
drop database sub_database02;
Can't drop database 'sub_database02'; database doesn't exist
drop database database01;
drop database database02;
drop database database03;
Expand Down
222 changes: 101 additions & 121 deletions test/distributed/cases/snapshot/restore_dropped_account.result

Large diffs are not rendered by default.

34 changes: 15 additions & 19 deletions test/distributed/cases/snapshot/restore_dropped_account.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ drop account acc01;
drop snapshot spsp01;




-- @bvt:issue#21092
-- sys level snapshot restore nonsys dropped account
drop account if exists acc02;
create account acc02 admin_name = 'test_account' identified by '111';
-- @session:id=2&user=acc02:test_account&password=111
-- @session:id=1&user=acc02:test_account&password=111
drop database if exists test01;
create database test01;
use test01;
Expand Down Expand Up @@ -222,10 +219,6 @@ create account acc03 admin_name = 'test_account' identified by '111';
restore account acc03 from snapshot spsp03;
drop account acc03;
drop snapshot spsp03;
-- @bvt:issue





-- cluster level snapshot restore cluster which contains dropped account
Expand Down Expand Up @@ -363,7 +356,7 @@ drop account acc06;

restore cluster from snapshot spsp06;

-- @session:id=8&user=acc04:test_account&password=111
-- @session:id=7&user=acc04:test_account&password=111
use test04;
select * from t1;
-- @ignore:1
Expand All @@ -372,15 +365,15 @@ select * from vtab32;
select * from vtab64;
-- @session

-- @session:id=9&user=acc05:test_account&password=111
-- @session:id=8&user=acc05:test_account&password=111
use test05;
select * from length01;
select * from t1;
-- @ignore:1
select * from test02;
-- @session

-- @session:id=10&user=acc06:test_account&password=111
-- @session:id=9&user=acc06:test_account&password=111
use test06;
select * from table01;
select * from t2;
Expand All @@ -393,18 +386,21 @@ drop account acc06;
drop snapshot spsp06;



-- @bvt:issue#21092
-- abnormal test: nonsys restore the deleted account
drop account if exists acc07;
create account acc07 admin_name = 'test_account' identified by '111';
-- @session:id=11&user=acc07:test_account&password=111

drop snapshot if exists spsp07;
create snapshot spsp07 for account spsp07;
-- @session
create snapshot spsp07 for account acc07;

drop account acc07;
-- @session:id=11&user=acc07:test_account&password=111

restore account acc07 from snapshot spsp07;

-- @session:id=11&user=acc07:test_account&password=111
show databases;
-- @session
-- @bvt:issue
show snapshots;

drop account acc07;
drop snapshot spsp07;
drop database restore_dropped_account;
2 changes: 0 additions & 2 deletions test/distributed/cases/snapshot/restore_pub_to_new.result
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ show publications;
publication database tables sub_account subscribed_accounts create_time update_time comments
show databases like 'db%';
Database
db09
db10
restore account acc01 from snapshot pub_sp to account acc03;
show publications;
publication database tables sub_account subscribed_accounts create_time update_time comments
Expand Down
8 changes: 4 additions & 4 deletions test/distributed/cases/snapshot/restore_pub_to_new.sql
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ insert into index03 values (9001,'1980-12-17', 'SMITH', 'CLERK', 'F', '2008-12-1
drop snapshot if exists pub_sp;
create snapshot pub_sp for account acc01;

-- @session:id=1&user=acc01:test_account&password=111
-- @session:id=2&user=acc01:test_account&password=111
drop publication if exists pub05;
create publication pub05 database db09 account acc02 comment 'publish db09';
drop publication if exists pub06;
Expand All @@ -64,7 +64,7 @@ create publication pub06 database db10 account acc02 comment 'publish db10';
show publications;
-- @session

-- @session:id=2&user=acc02:test_account&password=111
-- @session:id=3&user=acc02:test_account&password=111
drop database if exists sub05;
create database sub05 from acc01 publication pub05;
show databases;
Expand All @@ -83,15 +83,15 @@ show databases like 'db%';

drop account if exists acc03;
create account acc03 admin_name 'test_account' identified by '111';
-- @session:id=36&user=acc03:test_account&password=111
-- @session:id=4&user=acc03:test_account&password=111
-- @ignore:5,6
show publications;
show databases like 'db%';
-- @session

restore account acc01 from snapshot pub_sp to account acc03;

-- @session:id=3&user=acc03:test_account&password=111
-- @session:id=5&user=acc03:test_account&password=111
-- @ignore:5,6
show publications;
show databases like 'db%';
Expand Down
71 changes: 40 additions & 31 deletions test/distributed/cases/zz_accesscontrol/grant_privs_role.result
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,15 @@ user_grant_9 role_account_priv_8 table table ownership d.t
select * from testdb4.table_1;
internal error: do not have privilege to execute the statement
delete from testdb4.table_1;
insert into testdb5.table_2 values(20,'yeah',10.20);
internal error: do not have privilege to execute the statement
insert into testdb5.table_2 values(20,'yeah',10.20);
update testdb5.table_2 set name='bread' where id=20;
internal error: do not have privilege to execute the statement
select * from testdb5.table_2;
internal error: do not have privilege to execute the statement
id name num
3 pear 3.8
4 orange 5.03
9 8.0
20 bread 10.2
create user 'user_grant_10' identified by '123456';
create role 'role_account_priv_9';
create table grant_table_10(a int);
Expand All @@ -279,11 +282,11 @@ select user_name,role_name,obj_type,privilege_name,privilege_level from mo_catal
user_name role_name obj_type privilege_name privilege_level
user_grant_10 role_account_priv_9 table table all d.*
insert into testdb4.table_1 values (10,'ccc',1.8),(11,'ddd',5.3);
internal error: do not have privilege to execute the statement
select * from testdb4.table_1;
internal error: do not have privilege to execute the statement
id name num
10 ccc 1.8
11 ddd 5.3
update testdb4.table_1 set name='oppo' where id=10;
internal error: do not have privilege to execute the statement
delete from testdb4.table_1;
select * from testdb4.table_1;
internal error: do not have privilege to execute the statement
Expand Down Expand Up @@ -334,8 +337,7 @@ grant r1,r2,r3,r4,r5 to user1,user2,user3,user4,user5;
select count(*) from mo_catalog.mo_user_grant,mo_catalog.mo_user,mo_catalog.mo_role_privs where mo_user_grant.user_id=mo_user.user_id and mo_role_privs.role_id=mo_user_grant.role_id and role_name in ('r1','r2','r3','r4','r5');
count(*)
99
create table grant_table_10(a int);
internal error: do not have privilege to execute the statement
create table testdb5.grant_table_10(a int);
grant create role on account * to r5;
grant r5 to user1,user2,user3,user4,user5;
select user_name,role_name,obj_type,privilege_name,privilege_level from mo_catalog.mo_user_grant,mo_catalog.mo_user,mo_catalog.mo_role_privs where mo_user_grant.user_id=mo_user.user_id and mo_role_privs.role_id=mo_user_grant.role_id and role_name in ('r5');
Expand Down Expand Up @@ -365,30 +367,32 @@ user5 r5 table insert *.*
user5 r5 table update *.*
user5 r5 database create table *.*
user5 r5 account create role *
create role test_role;
internal error: do not have privilege to execute the statement
select count(*) from mo_catalog.mo_role where role_name='test_role';
internal error: do not have privilege to execute the statement
create role test_role_2;
select count(*) from mo_catalog.mo_role where role_name='test_role_2';
count(*)
1
create user user11 identified by '12345678';
grant select ,insert ,update on table *.* to r1,r2 with grant option;
grant r1,r2 to r6,r7;
select mr.role_name,mp.role_name,obj_type,privilege_name,privilege_level from mo_catalog.mo_role_grant mg,mo_catalog.mo_role mr ,mo_catalog.mo_role_privs mp where mg.grantee_id=mr.role_id and mg.granted_id = mp.role_id and mr.role_name in ('r6','r7');
role_name role_name obj_type privilege_name privilege_level
r6 r1 database create table *.*
r7 r1 database create table *.*
r6 r2 database create table *.*
r7 r2 database create table *.*
r6 r1 table table ownership d.t
r6 r1 table select *.*
r7 r1 table select *.*
r6 r2 table select *.*
r7 r2 table select *.*
r6 r1 table insert *.*
r7 r1 table insert *.*
r6 r2 table insert *.*
r7 r2 table insert *.*
r6 r1 table update *.*
r7 r1 database create table *.*
r7 r1 table table ownership d.t
r7 r1 table select *.*
r7 r1 table insert *.*
r7 r1 table update *.*
r6 r2 database create table *.*
r6 r2 table select *.*
r6 r2 table insert *.*
r6 r2 table update *.*
r7 r2 database create table *.*
r7 r2 table select *.*
r7 r2 table insert *.*
r7 r2 table update *.*
create user user12 identified by '12345678';
grant r2 to r8,r9,r10;
Expand All @@ -400,6 +404,7 @@ select role_name,obj_type,privilege_name,privilege_level,with_grant_option from
role_name obj_type privilege_name privilege_level with_grant_option
r1 database create table *.* false
r2 database create table *.* false
r1 table table ownership d.t false
r1 table select *.* true
r2 table select *.* true
r1 table insert *.* true
Expand All @@ -411,10 +416,12 @@ grant r1,r2 to user1,user2;
select user_name,role_name,obj_type,privilege_name,privilege_level from mo_catalog.mo_user_grant,mo_catalog.mo_user,mo_catalog.mo_role_privs where mo_user_grant.user_id=mo_user.user_id and mo_role_privs.role_id=mo_user_grant.role_id and user_name in ('user1','user2') and role_name in ('r1','r2');
user_name role_name obj_type privilege_name privilege_level
user1 r1 database create table *.*
user1 r1 table table ownership d.t
user1 r1 table select *.*
user1 r1 table insert *.*
user1 r1 table update *.*
user2 r1 database create table *.*
user2 r1 table table ownership d.t
user2 r1 table select *.*
user2 r1 table insert *.*
user2 r1 table update *.*
Expand All @@ -431,23 +438,25 @@ grant r1,r2 to r6,r7;
select mr.role_name,mp.role_name,obj_type,privilege_name,privilege_level from mo_catalog.mo_role_grant mg,mo_catalog.mo_role mr ,mo_catalog.mo_role_privs mp where mg.grantee_id=mr.role_id and mg.granted_id = mp.role_id and mr.role_name in ('r6','r7');
role_name role_name obj_type privilege_name privilege_level
r6 r1 database create table *.*
r7 r1 database create table *.*
r6 r2 database create table *.*
r7 r2 database create table *.*
r6 r1 table table ownership d.t
r6 r1 table select *.*
r7 r1 table select *.*
r6 r2 table select *.*
r7 r2 table select *.*
r6 r1 table insert *.*
r7 r1 table insert *.*
r6 r2 table insert *.*
r7 r2 table insert *.*
r6 r1 table update *.*
r7 r1 database create table *.*
r7 r1 table table ownership d.t
r7 r1 table select *.*
r7 r1 table insert *.*
r7 r1 table update *.*
r6 r2 database create table *.*
r6 r2 table select *.*
r6 r2 table insert *.*
r6 r2 table update *.*
r7 r2 database create table *.*
r7 r2 table select *.*
r7 r2 table insert *.*
r7 r2 table update *.*
drop user if exists user1,user2,user3,user4,user5,user11,user12,testuser,user_grant_1,user_grant_3,user_grant_4,user_grant_5,user_grant_6,user_grant_7,user_grant_8,user_grant_9,user_grant_10,user_prepare_01;
drop role if exists u_role,test_role,grant_role_1,role_sys_priv,role_account_priv_2,role_account_priv_3,role_account_priv_4,role_account_priv_5,role_account_priv_6,role_account_priv_7,role_account_priv_8,role_account_priv_9,role_account_priv_10,role_prepare_1;
drop role if exists u_role,test_role,test_role_2,grant_role_1,role_sys_priv,role_account_priv_2,role_account_priv_3,role_account_priv_4,role_account_priv_5,role_account_priv_6,role_account_priv_7,role_account_priv_8,role_account_priv_9,role_account_priv_10,role_prepare_1;
drop database if exists grant_db;
drop database if exists testdb;
drop database if exists testdb4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,16 @@ create user user1 identified by '12345678',user2 identified by '12345678',user3
grant r1,r2,r3,r4,r5 to user1,user2,user3,user4,user5;
select count(*) from mo_catalog.mo_user_grant,mo_catalog.mo_user,mo_catalog.mo_role_privs where mo_user_grant.user_id=mo_user.user_id and mo_role_privs.role_id=mo_user_grant.role_id and role_name in ('r1','r2','r3','r4','r5');
-- @session:id=13&user=sys:user1:r1&password=12345678
create table grant_table_10(a int);
create table testdb5.grant_table_10(a int);
-- @session

--一个role授权给多个用户
grant create role on account * to r5;
grant r5 to user1,user2,user3,user4,user5;
select user_name,role_name,obj_type,privilege_name,privilege_level from mo_catalog.mo_user_grant,mo_catalog.mo_user,mo_catalog.mo_role_privs where mo_user_grant.user_id=mo_user.user_id and mo_role_privs.role_id=mo_user_grant.role_id and role_name in ('r5');
-- @session:id=14&user=sys:user3:r5&password=12345678
create role test_role;
select count(*) from mo_catalog.mo_role where role_name='test_role';
create role test_role_2;
select count(*) from mo_catalog.mo_role where role_name='test_role_2';
-- @session

--多个role授权给多个role
Expand All @@ -288,7 +288,7 @@ grant r1,r2 to r6,r7;
select mr.role_name,mp.role_name,obj_type,privilege_name,privilege_level from mo_catalog.mo_role_grant mg,mo_catalog.mo_role mr ,mo_catalog.mo_role_privs mp where mg.grantee_id=mr.role_id and mg.granted_id = mp.role_id and mr.role_name in ('r6','r7');

drop user if exists user1,user2,user3,user4,user5,user11,user12,testuser,user_grant_1,user_grant_3,user_grant_4,user_grant_5,user_grant_6,user_grant_7,user_grant_8,user_grant_9,user_grant_10,user_prepare_01;
drop role if exists u_role,test_role,grant_role_1,role_sys_priv,role_account_priv_2,role_account_priv_3,role_account_priv_4,role_account_priv_5,role_account_priv_6,role_account_priv_7,role_account_priv_8,role_account_priv_9,role_account_priv_10,role_prepare_1;
drop role if exists u_role,test_role,test_role_2,grant_role_1,role_sys_priv,role_account_priv_2,role_account_priv_3,role_account_priv_4,role_account_priv_5,role_account_priv_6,role_account_priv_7,role_account_priv_8,role_account_priv_9,role_account_priv_10,role_prepare_1;
drop database if exists grant_db;
drop database if exists testdb;
drop database if exists testdb4;
Expand Down
Loading