[Maria-discuss] Are lock/unlock tables replicated in ROW / STATEMENT / MIXED r. mode
Hi Guys, quick question about lock tables with replication... I basically use it to achieve atomicity of some database writes, but it seems that queries like LOCK TABLES ___tsc WRITE UNLOCK TABLES are not replicated to slave. Eg. i can lock table on master, for write, but still read from it on the slave, which could lead to issues... We're reading some data from slaves, and writing data to it atomically using LOCK TABLES, it seems that this way will lead to race conditions and inconsistent reads from the slave. Any way of having aria/myisam writes to be atomic on the slaves too? I thought to copy the table to random temporary name, do the changes and then rename... but it seems like not very optimal. Thanks.
Am 13.01.2016 um 15:35 schrieb pslawek83:
Hi Guys, quick question about lock tables with replication...
I basically use it to achieve atomicity of some database writes, but it seems that queries like LOCK TABLES ___tsc WRITE UNLOCK TABLES are not replicated to slave.
Eg. i can lock table on master, for write, but still read from it on the slave, which could lead to issues...
We're reading some data from slaves, and writing data to it atomically using LOCK TABLES, it seems that this way will lead to race conditions and inconsistent reads from the slave. Any way of having aria/myisam writes to be atomic on the slaves too? I thought to copy the table to random temporary name, do the changes and then rename... but it seems like not very optimal.
that's why InnoDB and transactions exists use the right tool for the job
Also, you must understand that replication is asynchronous or semi-synchronous. What means - your update will come to slave in "unspecified" amount of time - maybe 1 millisecond, maybe 1 day. For example, your client may have access to master and slave but the link between master and slave may be broken. 2016-01-13 16:39 GMT+02:00 Reindl Harald <h.reindl@thelounge.net>:
Am 13.01.2016 um 15:35 schrieb pslawek83:
Hi Guys, quick question about lock tables with replication...
I basically use it to achieve atomicity of some database writes, but it seems that queries like LOCK TABLES ___tsc WRITE UNLOCK TABLES are not replicated to slave.
Eg. i can lock table on master, for write, but still read from it on the slave, which could lead to issues...
We're reading some data from slaves, and writing data to it atomically using LOCK TABLES, it seems that this way will lead to race conditions and inconsistent reads from the slave. Any way of having aria/myisam writes to be atomic on the slaves too? I thought to copy the table to random temporary name, do the changes and then rename... but it seems like not very optimal.
that's why InnoDB and transactions exists use the right tool for the job
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
participants (3)
-
Igor Mazur
-
pslawek83
-
Reindl Harald