2
votes

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

1 Answers

2
votes

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;-).