[MXS-4670] The fact that readconnroute doesn't block writes with router_options=slave is not documented Created: 2023-07-12  Updated: 2023-10-09  Resolved: 2023-07-13

Status: Closed
Project: MariaDB MaxScale
Component/s: Documentation
Affects Version/s: 2.5.26, 23.02.2
Fix Version/s: 2.5.27

Type: Bug Priority: Major
Reporter: Bryan Bancroft (Inactive) Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: triage
Environment:

ec2



 Description   

The fact that readconnroute will happily route writes to replicas with router_options=slave is not documented. This should be clearly stated in the documentation since one might assume that writes would be blocked.


Original description:

Issue; If I define a read-only service As a super user I can still write to a replica. This allows certain users to break an async cluster thru the RO service

Expectation; If connecting to a RO service, regardless of user, writes should be blocked

├──────────┼──────────────┼──────┼─────────────┼──────────────────────┼──────────────┼─────────────────┤
│ foo1     │ 131.21.1.185 │ 3306 │ 0           │ Master, Running      │ 0-1-45301601 │ MariaDB-Monitor │
├──────────┼──────────────┼──────┼─────────────┼──────────────────────┼──────────────┼─────────────────┤
│ foo2     │ 131.21.1.248 │ 3306 │ 1           │ Slave, Running       │ 0-2-45301602 │ MariaDB-Monitor │
└──────────┴──────────────┴──────┴─────────────┴──────────────────────┴──────────────┴─────────────────┘
 
MariaDB [test]> select @@hostname;
+------------+
| @@hostname |
+------------+
| fooshop-2  |
+------------+
1 row in set (0.001 sec)
 
MariaDB [test]> select @@read_only;
+-------------+
| @@read_only |
+-------------+
|           1 |
+-------------+
1 row in set (0.001 sec)
 
MariaDB [test]> drop table Phone_Transact;
Query OK, 0 rows affected (0.006 sec)



 Comments   
Comment by markus makela [ 2023-07-12 ]

If this is a readconnroute service with router_options=slave then this is by design. Determining whether a query is a write or not would require parsing it and readconnroute is designed to not require parsing. This isn't explicitly documented for the readconnroute but it can sort of be deduced from the fact that it only has one connection.

Comment by Bryan Bancroft (Inactive) [ 2023-07-12 ]

markus makela I spoke to Todd and we talked about the same. If a know limitation we need to document this as it is counter intuitive

Comment by markus makela [ 2023-07-12 ]

I'll add the following to the readconnroute documentation:

+**Warning:** `readconnroute` will not prevent writes from being done even if you
+  define `router_options=slave`. The client application is responsible for
+  making sure that it only performs read-only queries in such
+  cases. `readconnroute` is simple by design: it select a server and routes
+  everything there. If something more complex is required, the
+  [readwritesplit](ReadWriteSplit.md) router is usually the right choice.
+

Generated at Thu Feb 08 04:30:18 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.