By design,all read should be from slave,and update on master,
but consider the following situation:
there is a column water_mark in table_a,
and I need to read from table_b whose column time_mark is larger than column water_mark of
table_a,
If I read from slave,then update the column water_mark to "now()" in master,
what if there is a big delay between slave and master?
From stackoverflow
-
As you indicate, that would be unsafe;
SELECT ... FOR UPDATEand other "read in order to then write" transactions must have the read and write on the same server (and, on InnoDB tables, of course;-).UltimateBrent : Alex is correct, if you're basing an update on your read, then do both on the master.
0 comments:
Post a Comment