Does any of the mariadb backends support row-level read locking ? What I mean is:
I have an application that may run on three or four different machines. The number of machines is dynamic and not with fixed addresses. The application will execute the following two queries:
SELECT col3 from table1 WHERE col1=X
<do some checking with the version>
UPDATE table1 SET col2 = somevalue, col3 = somevalue WHERE col1=X
Now, between the first SELECT query and the second UPDATE query, I do not want any instance of the application to even read (not just WRITE) the record(s) corresponding to col1=X
Is it possible to achieve in mariadb ?
To answer my question:
We can use the SELECT ... FOR UPDATE clauses for locking the individual records. This lock will be automatically released on the transaction commit/rollback. More information at: https://dev.mysql.com/doc/refman/5.6/en/innodb-locking-reads.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With