Debian Codegraph @

mysql-test/suite/ndb/t/concurrent_grants.test

raw
1 --source include/have_ndb.inc
2
3 # ======= TEST CONCURRENCY
4 # =======
5 #
6 # Issue simultaneous ACL statements from many servers.
7 #
8 # ACL changes are executed *without* holding the Global Schema lock,
9 # but the locking inside Ndb_schema_dist_client::acl_notify() serializes
10 # ACL changes on a single server, and each server has a distinct name that
11 # is used as part of the primary key in ndb_schema.
12 #
13
14 #
15 # Set up environment
16 #
17 CREATE TABLE t1 (pk INT PRIMARY KEY, a INT) engine = ndb;
18 CREATE USER 'priv_test_U'@'localhost' IDENTIFIED by 'priv_test_pass';
19 GRANT NDB_STORED_USER ON *.* to 'priv_test_U'@'localhost';
20
21 disable_query_log;
22
23 connect (conn1,127.0.0.1,root,,test,$MASTER_MYPORT,);
24 connect (conn2,127.0.0.1,root,,test,$MASTER_MYPORT,);
25 connect (conn3,127.0.0.1,root,,test,$MASTER_MYPORT1,);
26 connect (conn4,127.0.0.1,root,,test,$MASTER_MYPORT1,);
27 connect (conn5,127.0.0.1,root,,test,$MASTER_MYPORT2,);
28 connect (conn6,127.0.0.1,root,,test,$MASTER_MYPORT2,);
29 connect (conn7,127.0.0.1,root,,test,$MASTER_MYPORT3,);
30 connect (conn8,127.0.0.1,root,,test,$MASTER_MYPORT3,);
31
32 #
33 # Issue a simple ACL change simultaneously on all 8 connections
34 #
35
36 connection conn1;
37 send GRANT SELECT ON test.t1 to 'priv_test_U'@'localhost';
38 connection conn2;
39 send GRANT SELECT ON test.t1 to 'priv_test_U'@'localhost';
40 connection conn3;
41 send GRANT SELECT ON test.t1 to 'priv_test_U'@'localhost';
42 connection conn4;
43 send GRANT SELECT ON test.t1 to 'priv_test_U'@'localhost';
44 connection conn5;
45 send GRANT SELECT ON test.t1 to 'priv_test_U'@'localhost';
46 connection conn6;
47 send GRANT SELECT ON test.t1 to 'priv_test_U'@'localhost';
48 connection conn7;
49 send GRANT SELECT ON test.t1 to 'priv_test_U'@'localhost';
50 connection conn8;
51 send GRANT SELECT ON test.t1 to 'priv_test_U'@'localhost';
52
53 connection conn1;
54 reap;
55 connection conn2;
56 reap;
57 connection conn3;
58 reap;
59 connection conn4;
60 reap;
61 connection conn5;
62 reap;
63 connection conn6;
64 reap;
65 connection conn7;
66 reap;
67 connection conn8;
68 reap;
69
70 #
71 # Clean up
72 #
73
74 connection default;
75 drop user priv_test_U@localhost;
76 drop table t1;