views:

112

answers:

1

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?

+1  A: 

As you indicate, that would be unsafe; SELECT ... FOR UPDATE and other "read in order to then write" transactions must have the read and write on the same server (and, on InnoDB tables, of course;-).

Alex Martelli
Alex is correct, if you're basing an update on your read, then do both on the master.
UltimateBrent