Re: Sync Rep: First Thoughts on Code
От | Markus Wanner |
---|---|
Тема | Re: Sync Rep: First Thoughts on Code |
Дата | |
Msg-id | 494429AB.2060201@bluegap.ch обсуждение исходный текст |
Ответ на | Re: Sync Rep: First Thoughts on Code (Hannu Krosing <hannu@2ndQuadrant.com>) |
Ответы |
Re: Sync Rep: First Thoughts on Code
|
Список | pgsql-hackers |
Hi, Hannu Krosing wrote: > You can have a variantof sync rep + hot standby where the master does > not return committed before the slave has both synced the data and > replied the transaction so that it is visible on slave but in that case > you may have a usecase, where it is actually visible on slave _before_ > it is visible on master. As long as it's not visible *before* the client requests a COMMIT, that certainly doesn't matter (because the application cannot check that). What matters is, that an application might expect a node to show the changes of a transaction which has previously (seen from the application itself) been committed and acknowledged by another node. AFAICT the common understanding of synchronous replication is, that all nodes confirm to have committed the changes of a transaction *before* acknowledging COMMIT to the application (and obviously only *after* the application requested to COMMIT the transaction, so the guarantee is that all nodes commit *sometime* within that time frame, which is certainly possible to guarantee, see 2PC approaches). This guarantee is not provided by the Postgres-R algorithm, nor by the approach presented. Both only guarantee, that the transaction *will* get committed (and thus get visible) on all nodes *sometime* *after* the application requested to commit it (even in case of various failures, that is) [1]. As cited before, that has been enough of a reason for Jan Wieck to call Postgres-R asynchronous, and I certainly see his point. Note that the amount of time that passes between the commit acknowledgment and the actual commit on remote nodes may theoretically be infinitely long. And in practice certainly long enough for an application to notice the difference. However, it still is a practical optimization, because most applications should cope with it just fine. But not all... Do you consider the proposed log shipping approach to be synchronous? How about the Postgres-R algorithm? Regards Markus Wanner [1]: of course these approaches also guarantee that the transaction is committed on the local node *before* acknowledging commit, so that subsequent (seen from the application) queries are guaranteed to see the changes. But that guarantee only holds true for the local node.
В списке pgsql-hackers по дате отправления: