[MXS-1295] MaxScale's readwritesplit router does not take into account the fact that stored procedure call may change the value of a user variable Created: 2017-06-23 Updated: 2021-10-13 Resolved: 2017-09-20 |
|
| Status: | Closed |
| Project: | MariaDB MaxScale |
| Component/s: | readwritesplit |
| Affects Version/s: | 2.1.3 |
| Fix Version/s: | 2.1.9 |
| Type: | Bug | Priority: | Major |
| Reporter: | Valerii Kravchuk | Assignee: | markus makela |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Sprint: | 2017-42 | ||||||||||||||||||||
| Description |
|
MaxScale's ReadWriteSplit router is not smart enough to assume that stored procedure call may modify a user variable. If we have a procedure, p1, defined like this:
then for the following sequence of statements:
we may still get NULL from the last statement, even if the value is changed inside the procedure and this is clear when we connect to master directly. MaxScale should be smarter and either assume that any procedure call may change data, including user variables, or parse the definition of the procedure called to check if this is the case, before decide what node to route queries to. |
| Comments |
| Comment by Johan Wikman [ 2017-09-11 ] | |
|
Parsing the procedure to figure out whether it requires subsequent statements to be routed to the master is not feasible. In practice, what can be done is to pin the session to master after a CALL statement taking user variables as argument, or simply after every CALL statement. The effect of that can currently be achieved by using the CCR filter with
and a sufficiently large value for time (larger than the length of the longest session). | |
| Comment by markus makela [ 2017-09-20 ] | |
|
The CALL statements can now be configured to "lock" the session to the master node. This new feature is disabled by default and can be enabled by adding strict_sp_calls=true to the readwritesplit configuration. |