Re: old_snapshot_threshold bottleneck on replica

From: Maxim Orlov <orlovmg(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: old_snapshot_threshold bottleneck on replica
Date: 2023-01-30 10:18:55
Message-ID: CACG=ezaUKQbujov95xgutC9Bb2-+6JsTcSmqDubwMi6uqNt=2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 27 Jan 2023 at 18:18, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

>
> Interesting, but it's still not entirely clear to me from reading the
> comments why we should think that this is safe.
>

In overall, I think this is safe, because we do not change algorithm here.
More specific, threshold_timestamp have only used in a few cases:
1). To get the latest value by calling GetOldSnapshotThresholdTimestamp.
This will work, since we only change the sync type here from the spinlock
to an atomic.
2). In TransactionIdLimitedForOldSnapshots, but here no changes in the
behaviour will be done. Sync model will be the save as before the patch.
3). In SnapshotTooOldMagicForTest, which is a stub to make
old_snapshot_threshold tests appear "working". But no coherence with the
threshold_xid here.

So, we have a two use cases for the threshold_timestamp:
a). When the threshold_timestamp is used in conjunction with the
threshold_xid. We must use spinlock to sync.
b). When the threshold_timestamp is used without conjunction with the
threshold_xid. In this case, we use atomic values.

--
Best regards,
Maxim Orlov.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Maxim Orlov 2023-01-30 10:22:31 Re: Add SHELL_EXIT_CODE to psql
Previous Message Aleksander Alekseev 2023-01-30 10:18:37 MacOS: xsltproc fails with "warning: failed to load external entity"