public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: Daniel McKenzie <[email protected]>
Cc: [email protected]
Subject: Re: Unexpected data when subscribing to logical replication slot
Date: Wed, 8 May 2024 09:28:01 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CACKLY6hYp+9W9xijXFh_UEpDuoo7bxg-A3deBKcEzEub3K+Kfg@mail.gmail.com>
References: <CACKLY6hwMnSjjipZ57TTz_FC9aWBkg7OpNLJ1tu+GvfEFc4hJA@mail.gmail.com>
	<[email protected]>
	<CACKLY6hYp+9W9xijXFh_UEpDuoo7bxg-A3deBKcEzEub3K+Kfg@mail.gmail.com>

On 5/8/24 08:24, Daniel McKenzie wrote:
> It's running both (in docker containers) and also quite a few more 
> docker containers running various .NET applications.

I think what you found is that the r7a.medium instance is not capable 
enough to do all that it is asked without introducing lag under load. 
Answering the questions posed by Tomas Vondra would help get to the 
actual cause of the lag.

In meantime my suspicion is this part:

"For example, when I use a psql terminal to update a user's last name 
from "Jones" to "Smith" then I would expect the enrichment query to find 
"Smith" but it will sometimes still find "Jones". It finds the old data 
perhaps 1 in 50 times."

If this is being run against the Postgres server my guess is that 
synchronous_commit=on is causing the commit on the server to wait for 
the WAL records to be flushed to disk and this is not happening in a 
timely manner in the '... 1 in 50 times' you mention. In that case you 
see the old values not the new committed values. This seems to be 
confirmed when you set synchronous_commit=off and don't see old values.
For completeness per:

https://www.postgresql.org/docs/current/wal-async-commit.html

"However, for short transactions this delay is a major component of the 
total transaction time. Selecting asynchronous commit mode means that 
the server returns success as soon as the transaction is logically 
completed, before the WAL records it generated have actually made their 
way to disk. This can provide a significant boost in throughput for 
small transactions.

Asynchronous commit introduces the risk of data loss. There is a short 
time window between the report of transaction completion to the client 
and the time that the transaction is truly committed (that is, it is 
guaranteed not to be lost if the server crashes).  ...
"

> 
> Daniel McKenzie
> Software Developer

-- 
Adrian Klaver
[email protected]







view thread (7+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Unexpected data when subscribing to logical replication slot
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox