@@ -18,31 +18,31 @@ drop table t3;
18
18
connection con1;
19
19
select @@global.read_only;
20
20
@@global.read_only
21
- 1
21
+ ON
22
22
create table t3 (a int);
23
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
23
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
24
24
insert into t1 values(1);
25
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
25
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
26
26
drop trigger trg1;
27
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
27
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
28
28
update t1 set a=1 where 1=0;
29
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
29
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
30
30
update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a;
31
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
31
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
32
32
delete t1,t2 from t1,t2 where t1.a=t2.a;
33
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
33
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
34
34
create temporary table t3 (a int);
35
35
create temporary table t4 (a int) select * from t3;
36
36
insert into t3 values(1);
37
37
insert into t4 select * from t3;
38
38
create table t3 (a int);
39
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
39
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
40
40
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
41
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
41
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
42
42
update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a;
43
43
update t4,t3 set t4.a=t3.a+1 where t4.a=t3.a;
44
44
delete t1 from t1,t3 where t1.a=t3.a;
45
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
45
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
46
46
delete t3 from t1,t3 where t1.a=t3.a;
47
47
delete t4 from t3,t4 where t4.a=t3.a;
48
48
create temporary table t1 (a int);
@@ -51,7 +51,7 @@ update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
51
51
delete t1 from t1,t3 where t1.a=t3.a;
52
52
drop table t1;
53
53
insert into t1 values(1);
54
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
54
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
55
55
drop temporary table if exists t1;
56
56
Warnings:
57
57
Note 1051 Unknown table 'test.t1'
@@ -69,11 +69,11 @@ set global read_only=1;
69
69
connection con1;
70
70
select @@global.read_only;
71
71
@@global.read_only
72
- 0
72
+ OFF
73
73
unlock tables ;
74
74
select @@global.read_only;
75
75
@@global.read_only
76
- 1
76
+ ON
77
77
connection default;
78
78
reap;
79
79
connection default;
@@ -88,11 +88,11 @@ unlock tables ;
88
88
set global read_only=1;
89
89
select @@global.read_only;
90
90
@@global.read_only
91
- 1
91
+ ON
92
92
connection con1;
93
93
select @@global.read_only;
94
94
@@global.read_only
95
- 1
95
+ ON
96
96
unlock tables ;
97
97
connection default;
98
98
connection default;
@@ -108,7 +108,7 @@ set global read_only=1;
108
108
connection con1;
109
109
select @@global.read_only;
110
110
@@global.read_only
111
- 1
111
+ ON
112
112
ROLLBACK;
113
113
connection default;
114
114
set global read_only=0;
@@ -124,7 +124,7 @@ set global read_only=1;
124
124
connection default;
125
125
select @@global.read_only;
126
126
@@global.read_only
127
- 1
127
+ ON
128
128
unlock tables;
129
129
disconnect root2;
130
130
drop temporary table ttt;
@@ -157,11 +157,11 @@ flush privileges;
157
157
connect con_bug27440,127.0.0.1,mysqltest_u1,,test,$MASTER_MYPORT,;
158
158
connection con_bug27440;
159
159
create database mysqltest_db2;
160
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
160
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
161
161
show databases like '%mysqltest_db2%';
162
162
Database (%mysqltest_db2%)
163
163
drop database mysqltest_db1;
164
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
164
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
165
165
disconnect con_bug27440;
166
166
connection default;
167
167
delete from mysql.user where User like 'mysqltest_%';
@@ -179,7 +179,7 @@ GRANT ALTER ON test1.* TO user1@localhost;
179
179
CREATE DATABASE test1;
180
180
SET GLOBAL read_only=1;
181
181
ALTER DATABASE test1 CHARACTER SET utf8;
182
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
182
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
183
183
SET GLOBAL read_only=0;
184
184
DROP DATABASE test1;
185
185
DROP USER user1@localhost;
@@ -210,21 +210,131 @@ connection con1;
210
210
START TRANSACTION;
211
211
# Check that table updates are still disallowed.
212
212
INSERT INTO t1 VALUES (3);
213
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
213
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
214
214
UPDATE t1 SET a= 1;
215
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
215
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
216
216
DELETE FROM t1;
217
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
217
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
218
218
COMMIT;
219
219
START TRANSACTION READ ONLY;
220
220
COMMIT;
221
221
# Explicit RW trans is not allowed without super privilege
222
222
START TRANSACTION READ WRITE;
223
- ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
223
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
224
224
COMMIT;
225
225
disconnect con1;
226
226
connection default;
227
227
DROP USER user1;
228
228
SET GLOBAL read_only= 0;
229
229
DROP TABLE t1;
230
230
# End of 10.0 tests
231
+ #
232
+ # MDEV-36425 Extend read_only to also block share locks and super user
233
+ #
234
+ CREATE USER user1;
235
+ GRANT ALL on test.* to user1;
236
+ connect con1, localhost, user1;
237
+ connection default;
238
+ CREATE TABLE t1 (a int primary key auto_increment);
239
+ insert into t1 values (1),(2);
240
+ show variables like "read_only";
241
+ Variable_name Value
242
+ read_only OFF
243
+ SET GLOBAL read_only=1;
244
+ show variables like "read_only";
245
+ Variable_name Value
246
+ read_only ON
247
+ # admin
248
+ insert into t1 values ();
249
+ lock tables t1 read;
250
+ unlock tables;
251
+ lock tables t1 write;
252
+ unlock tables;
253
+ begin;
254
+ select count(*) from t1 LOCK IN SHARE MODE;
255
+ count(*)
256
+ 3
257
+ select count(*) from t1,(select a from t1 LOCK IN SHARE MODE) as t2;
258
+ count(*)
259
+ 9
260
+ commit;
261
+ # user
262
+ connection con1;
263
+ insert into t1 values ();
264
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
265
+ lock tables t1 read;
266
+ unlock tables;
267
+ lock tables t1 write;
268
+ ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
269
+ unlock tables;
270
+ begin;
271
+ select count(*) from t1 LOCK IN SHARE MODE;
272
+ count(*)
273
+ 3
274
+ select count(*) from t1,(select a from t1 LOCK IN SHARE MODE) as t2;
275
+ count(*)
276
+ 9
277
+ commit;
278
+ connection default;
279
+ SET GLOBAL read_only=2;
280
+ show variables like "read_only";
281
+ Variable_name Value
282
+ read_only NO_LOCK
283
+ # admin
284
+ insert into t1 values ();
285
+ lock tables t1 read;
286
+ unlock tables;
287
+ lock tables t1 write;
288
+ unlock tables;
289
+ begin;
290
+ select count(*) from t1 LOCK IN SHARE MODE;
291
+ count(*)
292
+ 4
293
+ select count(*) from t1,(select a from t1 LOCK IN SHARE MODE) as t2;
294
+ count(*)
295
+ 16
296
+ commit;
297
+ #user
298
+ connection con1;
299
+ insert into t1 values ();
300
+ ERROR HY000: The MariaDB server is running with the --read-only=NO_LOCK option so it cannot execute this statement
301
+ lock tables t1 read;
302
+ ERROR HY000: The MariaDB server is running with the --read-only=NO_LOCK option so it cannot execute this statement
303
+ unlock tables;
304
+ lock tables t1 write;
305
+ ERROR HY000: The MariaDB server is running with the --read-only=NO_LOCK option so it cannot execute this statement
306
+ unlock tables;
307
+ begin;
308
+ select count(*) from t1 LOCK IN SHARE MODE;
309
+ ERROR HY000: The MariaDB server is running with the --read-only=NO_LOCK option so it cannot execute this statement
310
+ select count(*) from t1,(select a from t1 LOCK IN SHARE MODE) as t2;
311
+ ERROR HY000: The MariaDB server is running with the --read-only=NO_LOCK option so it cannot execute this statement
312
+ commit;
313
+ connection default;
314
+ SET GLOBAL read_only=3;
315
+ show variables like "read_only";
316
+ Variable_name Value
317
+ read_only NO_LOCK_NO_ADMIN
318
+ # admin
319
+ insert into t1 values ();
320
+ ERROR HY000: The MariaDB server is running with the --read-only=NO_LOCK_NO_ADMIN option so it cannot execute this statement
321
+ lock tables t1 read;
322
+ ERROR HY000: The MariaDB server is running with the --read-only=NO_LOCK_NO_ADMIN option so it cannot execute this statement
323
+ unlock tables;
324
+ lock tables t1 write;
325
+ ERROR HY000: The MariaDB server is running with the --read-only=NO_LOCK_NO_ADMIN option so it cannot execute this statement
326
+ unlock tables;
327
+ begin;
328
+ select count(*) from t1 LOCK IN SHARE MODE;
329
+ ERROR HY000: The MariaDB server is running with the --read-only=NO_LOCK_NO_ADMIN option so it cannot execute this statement
330
+ select count(*) from t1,(select a from t1 LOCK IN SHARE MODE) as t2;
331
+ ERROR HY000: The MariaDB server is running with the --read-only=NO_LOCK_NO_ADMIN option so it cannot execute this statement
332
+ commit;
333
+ SET GLOBAL read_only=0;
334
+ select count(*) from t1;
335
+ count(*)
336
+ 4
337
+ drop table t1;
338
+ drop user user1;
339
+ disconnect con1;
340
+ # End of 11.8 tests
0 commit comments