pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedPostgreSQL 9.3 synchronous replication
7+ messages / 4 participants
[nested] [flat]
* PostgreSQL 9.3 synchronous replication
@ 2015-01-21 08:25 Sergey Arlashin <sergeyarl.maillist@gmail.com>
2015-01-21 11:19 ` Re: PostgreSQL 9.3 synchronous replication Vladimir Borodin <root@simply.name>
2015-01-21 11:34 ` Re: PostgreSQL 9.3 synchronous replication Matheus de Oliveira <matioli.matheus@gmail.com>
0 siblings, 2 replies; 7+ messages in thread
From: Sergey Arlashin @ 2015-01-21 08:25 UTC (permalink / raw)
To: pgsql-admin
Hi!
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.
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?
--
Best regards,
Sergey Arlashin
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: PostgreSQL 9.3 synchronous replication
2015-01-21 08:25 PostgreSQL 9.3 synchronous replication Sergey Arlashin <sergeyarl.maillist@gmail.com>
@ 2015-01-21 11:19 ` Vladimir Borodin <root@simply.name>
2015-01-21 15:05 ` Re: PostgreSQL 9.3 synchronous replication Sergey Arlashin <sergeyarl.maillist@gmail.com>
1 sibling, 1 reply; 7+ messages in thread
From: Vladimir Borodin @ 2015-01-21 11:19 UTC (permalink / raw)
To: Sergey Arlashin <sergeyarl.maillist@gmail.com>; +Cc: pgsql-admin
> 21 янв. 2015 г., в 11:25, Sergey Arlashin <sergeyarl.maillist@gmail.com> написал(а):
>
> Hi!
>
> 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.
>
> 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?
You should set synchronous_commit = on (seems, that right now you have remote_write). See http://www.postgresql.org/docs/current/static/runtime-config-wal.html#GUC-SYNCHRONOUS-COMMIT <http://www.postgresql.org/docs/current/static/runtime-config-wal.html#GUC-SYNCHRONOUS-COMMIT; for more details.
>
> --
> Best regards,
> Sergey Arlashin
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
--
May the force be with you...
http://simply.name
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: PostgreSQL 9.3 synchronous replication
2015-01-21 08:25 PostgreSQL 9.3 synchronous replication Sergey Arlashin <sergeyarl.maillist@gmail.com>
2015-01-21 11:19 ` Re: PostgreSQL 9.3 synchronous replication Vladimir Borodin <root@simply.name>
@ 2015-01-21 15:05 ` Sergey Arlashin <sergeyarl.maillist@gmail.com>
0 siblings, 0 replies; 7+ messages in thread
From: Sergey Arlashin @ 2015-01-21 15:05 UTC (permalink / raw)
To: Vladimir Borodin <root@simply.name>; +Cc: pgsql-admin
On Jan 21, 2015, at 3:19 PM, Vladimir Borodin <root@simply.name> wrote:
>
>> 21 янв. 2015 г., в 11:25, Sergey Arlashin <sergeyarl.maillist@gmail.com> написал(а):
>>
>> Hi!
>>
>> 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.
>>
>> 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?
>
> You should set synchronous_commit = on (seems, that right now you have remote_write). See http://www.postgresql.org/docs/current/static/runtime-config-wal.html#GUC-SYNCHRONOUS-COMMIT for more details.
Actualy I have 'synchronous_commit = on' in my postgresql.conf:
postgres=# show synchronous_commit ;
synchronous_commit
--------------------
on
(1 row)
--
Best regards,
Sergey Arlashin
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: PostgreSQL 9.3 synchronous replication
2015-01-21 08:25 PostgreSQL 9.3 synchronous replication Sergey Arlashin <sergeyarl.maillist@gmail.com>
@ 2015-01-21 11:34 ` Matheus de Oliveira <matioli.matheus@gmail.com>
2015-01-21 15:21 ` Re: PostgreSQL 9.3 synchronous replication Sergey Arlashin <sergeyarl.maillist@gmail.com>
1 sibling, 1 reply; 7+ messages in thread
From: Matheus de Oliveira @ 2015-01-21 11:34 UTC (permalink / raw)
To: Sergey Arlashin <sergeyarl.maillist@gmail.com>; +Cc: pgsql-admin
On Wed, Jan 21, 2015 at 6:25 AM, Sergey Arlashin <
sergeyarl.maillist@gmail.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
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: PostgreSQL 9.3 synchronous replication
2015-01-21 08:25 PostgreSQL 9.3 synchronous replication Sergey Arlashin <sergeyarl.maillist@gmail.com>
2015-01-21 11:34 ` Re: PostgreSQL 9.3 synchronous replication Matheus de Oliveira <matioli.matheus@gmail.com>
@ 2015-01-21 15:21 ` Sergey Arlashin <sergeyarl.maillist@gmail.com>
2015-01-21 18:21 ` Re: PostgreSQL 9.3 synchronous replication Matheus de Oliveira <matioli.matheus@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Sergey Arlashin @ 2015-01-21 15:21 UTC (permalink / raw)
To: Matheus de Oliveira <matioli.matheus@gmail.com>; +Cc: pgsql-admin
On Jan 21, 2015, at 3:34 PM, Matheus de Oliveira <matioli.matheus@gmail.com> wrote:
>
> On Wed, Jan 21, 2015 at 6:25 AM, Sergey Arlashin <sergeyarl.maillist@gmail.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).
>
Yes, I understand this. But I was wondering whether it is possible to somehow force this procedure. Or wait until xlog is applied on slave and only then consider the transaction committed.
Or at least improve the ability of slave to apply xlogs?
--
Best regards,
Sergey Arlashin
> Regards,
> --
> Matheus de Oliveira
> Analista de Banco de Dados
> Dextra Sistemas - MPS.Br nível F!
> www.dextra.com.br/postgres
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: PostgreSQL 9.3 synchronous replication
2015-01-21 08:25 PostgreSQL 9.3 synchronous replication Sergey Arlashin <sergeyarl.maillist@gmail.com>
2015-01-21 11:34 ` Re: PostgreSQL 9.3 synchronous replication Matheus de Oliveira <matioli.matheus@gmail.com>
2015-01-21 15:21 ` Re: PostgreSQL 9.3 synchronous replication Sergey Arlashin <sergeyarl.maillist@gmail.com>
@ 2015-01-21 18:21 ` Matheus de Oliveira <matioli.matheus@gmail.com>
2015-01-22 04:15 ` Re: PostgreSQL 9.3 synchronous replication Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 7+ messages in thread
From: Matheus de Oliveira @ 2015-01-21 18:21 UTC (permalink / raw)
To: Sergey Arlashin <sergeyarl.maillist@gmail.com>; +Cc: pgsql-admin
On Wed, Jan 21, 2015 at 1:21 PM, Sergey Arlashin <
sergeyarl.maillist@gmail.com> wrote:
> Yes, I understand this. But I was wondering whether it is possible to
> somehow force this procedure. Or wait until xlog is applied on slave and
> only then consider the transaction committed.
You'd have to do it somehow in your application. AFAICT, PostgreSQL does
not provide any way to that in current versions (might be done in future
releases).
Regards,
--
Matheus de Oliveira
Analista de Banco de Dados
Dextra Sistemas - MPS.Br nível F!
www.dextra.com.br/postgres
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: PostgreSQL 9.3 synchronous replication
2015-01-21 08:25 PostgreSQL 9.3 synchronous replication Sergey Arlashin <sergeyarl.maillist@gmail.com>
2015-01-21 11:34 ` Re: PostgreSQL 9.3 synchronous replication Matheus de Oliveira <matioli.matheus@gmail.com>
2015-01-21 15:21 ` Re: PostgreSQL 9.3 synchronous replication Sergey Arlashin <sergeyarl.maillist@gmail.com>
2015-01-21 18:21 ` Re: PostgreSQL 9.3 synchronous replication Matheus de Oliveira <matioli.matheus@gmail.com>
@ 2015-01-22 04:15 ` Bruce Momjian <bruce@momjian.us>
0 siblings, 0 replies; 7+ messages in thread
From: Bruce Momjian @ 2015-01-22 04:15 UTC (permalink / raw)
To: Matheus de Oliveira <matioli.matheus@gmail.com>; +Cc: Sergey Arlashin <sergeyarl.maillist@gmail.com>; pgsql-admin
On Wed, Jan 21, 2015 at 04:21:26PM -0200, Matheus de Oliveira wrote:
>
> On Wed, Jan 21, 2015 at 1:21 PM, Sergey Arlashin <sergeyarl.maillist@gmail.com>
> wrote:
>
> Yes, I understand this. But I was wondering whether it is possible to
> somehow force this procedure. Or wait until xlog is applied on slave and
> only then consider the transaction committed.
>
>
> You'd have to do it somehow in your application. AFAICT, PostgreSQL does not
> provide any way to that in current versions (might be done in future releases).
The problem with forcing the WAL to be replayed is that it might cause
many existing transactions to be canceled due to their snapshots
becoming invalid.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2015-01-22 04:15 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 08:25 PostgreSQL 9.3 synchronous replication Sergey Arlashin <sergeyarl.maillist@gmail.com>
2015-01-21 11:19 ` Vladimir Borodin <root@simply.name>
2015-01-21 15:05 ` Sergey Arlashin <sergeyarl.maillist@gmail.com>
2015-01-21 11:34 ` Matheus de Oliveira <matioli.matheus@gmail.com>
2015-01-21 15:21 ` Sergey Arlashin <sergeyarl.maillist@gmail.com>
2015-01-21 18:21 ` Matheus de Oliveira <matioli.matheus@gmail.com>
2015-01-22 04:15 ` Bruce Momjian <bruce@momjian.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox