Re: PostgreSQL 9.3 synchronous replication

From: Matheus de Oliveira <matioli(dot)matheus(at)gmail(dot)com>
To: Sergey Arlashin <sergeyarl(dot)maillist(at)gmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: PostgreSQL 9.3 synchronous replication
Date: 2015-01-21 11:34:06
Message-ID: CAJghg4KkZC-F1QysXFSn_PvdjtV2eaxnd3NKKAp_sodH3NHRFg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, Jan 21, 2015 at 6:25 AM, Sergey Arlashin <
sergeyarl(dot)maillist(at)gmail(dot)com> wrote:

> Recently I've found out that synchronous replication just guarantees that
> the commit has reached the transaction log on the slave. Therefore that
> doesn't mean the slave has replayed the transaction log and a query against
> the slave will show the transaction's results.
>
>
The exact guarantee depends on synchronous_commit configuration, but none
provides guarantee that the xlog records have been applied and ready to
query, you are right about it.

> So I'm wondering if there is a way to ensure that once a transaction is
> committed the data is available on the slave and I can get it by executing
> a query against the slave?
>

Well, you can use compare the values of pg_current_xlog_location on the
master immediately after commit and pg_last_xlog_replay_location on the
slave (or even use pg_stat_replication.replay_location).

Regards,
--
Matheus de Oliveira
Analista de Banco de Dados
Dextra Sistemas - MPS.Br nível F!
www.dextra.com.br/postgres

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Sergey Arlashin 2015-01-21 15:05:20 Re: PostgreSQL 9.3 synchronous replication
Previous Message Vladimir Borodin 2015-01-21 11:19:05 Re: PostgreSQL 9.3 synchronous replication