[MXS-1591] Adding get_lock and release_lock support Created: 2018-01-02  Updated: 2018-01-29  Resolved: 2018-01-29

Status: Closed
Project: MariaDB MaxScale
Component/s: QueryClassifier
Affects Version/s: 2.1.12, 2.2.0
Fix Version/s: 2.2.2

Type: Bug Priority: Major
Reporter: Maikel Punie Assignee: Johan Wikman
Resolution: Fixed Votes: 0
Labels: None


 Description   

Currently the features below are not supported when we use maxscale and a router that can end up on multiple servers.
GET_LOCK()
RELEASE_LOCK()
IS_FREE_LOCK()
IS_USED_LOCK()

If we do a get_lock and get routed to serverA and later on we do a release_lock and this is routed to serverB the lock on serverA is never released.
It can be used if force the router to always go to the master server.

Because of this we can not use the readwrite split router.



 Comments   
Comment by markus makela [ 2018-01-02 ]

Appears that those functions are wrongly classified as read-only functions when in fact they modify the database.

Maikel Punie for the sake of completeness, please add at least the affected version as well as the component the problem affects.

Comment by Johan Wikman [ 2018-01-10 ]

They cannot simply be reclassified as read-write functions because you can issue them in read-only transactions.

It would seem that irrespective of what else is going on, these have to be sent to all servers.

Comment by Johan Wikman [ 2018-01-29 ]

Maikel Punie In what context do you use those functions? Always within a transaction or outside of transactions?

Comment by Maikel Punie [ 2018-01-29 ]

outside transactions (autocommit enabled in the python calls)

Comment by Johan Wikman [ 2018-01-29 ]

Maikel Punie Ok, for MaxScale 2.2.2 we are going to change it so that all these functions will cause the query to be sent to master. That should fix your case.

Comment by Johan Wikman [ 2018-01-29 ]

Fix it for the non-transactional case, that is. If they are used inside read-only transactions then something else might still be needed.

Comment by Johan Wikman [ 2018-01-29 ]

Use of the functions

GET_LOCK()
RELEASE_LOCK()
IS_FREE_LOCK()
IS_USED_LOCK()

will now cause the statement to be classified as WRITE, which will cause it to be sent to master. With this change, locking will work as expected outside transactions and across transactions that are not explicitly read-only.

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