2

I was wondering if there is any way on a MySQL slave server to get a "consistent read" for a specific query. Let's say I send a query to the slave server at 8:30:15, and at that moment, the slave is still processing queries from the master bin log with timestamps dating from before that point in time. For that specific query though, I specified in some way to the slave that I want a consistent read, so the slave would put a hold on the read query until it has caught up to 8:30:15 in the master bin log, thus allowing me to receive a result that is consistent with what would have been given by the master had it received the query instead. Of course, that would cause a delay for me while I wait for my read result, which I wouldn't have to suffer if I had requested directly from the master, but it still allows me to send that query to the slave and get a consistent read from it.

Is there anything in MySQL that allows for this kind of query specific options on a slave?

Thanks!

4

1 回答 1

0

从站无法使用最新更新为查询提供服务,因此我们可以如下所示。

在这种情况下,我们应该将 HttpSesion 标记为脏,这样所有的读取都将转到主服务器而不是从服务器,后者将提供最新的副本。

于 2013-09-24T18:45:13.237 回答