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.