pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kartyshov Ivan <i.kartyshov@postgrespro.ru>
To: Andy Fan <zhihuifan1213@163.com>
Cc: Alexander Korotkov <aekorotkov@gmail.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Euler Taveira <euler@eulerto.com>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Peter Eisentraut <peter@eisentraut.org>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Peter Smith <smithpb2250@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: [HACKERS] make async slave to wait for lsn to be replayed
Date: Tue, 02 Apr 2024 13:11:27 +0300
Message-ID: <6eb8c9f22b075964f502080dadc16cb2@postgrespro.ru> (raw)
In-Reply-To: <87h6gk9nvc.fsf@163.com>
References: <CAPpHfdtiGgn0iS1KbW2HTam-1+oK+vhXZDAcnX9hKaA7Oe=F-A@mail.gmail.com>
	<CAPpHfdu+HAF=XPX2v+Qq+faV2bVhj=qLz1TbtAZX5shg8Zviow@mail.gmail.com>
	<a7601ec6-01d8-4561-b81d-a6605e9b4d55@eisentraut.org>
	<CALj2ACV5+A2fRkMdB1YLH8tHMy8xsUr1HMu5RffJpmnfH-_42A@mail.gmail.com>
	<5358d911a08ef2952b1e9f74062426ee@postgrespro.ru>
	<CAPpHfdsQNqQoFN_OosMUkZWLE-s=or=t+XVEHF5AGuMbdBMpew@mail.gmail.com>
	<CAPpHfdvZXSiVCqFNMzpk7Zhxk4hB6T55b+79J1nKLotNFL25Qw@mail.gmail.com>
	<CA+hUKGKXXP8ZgTfFfjhv77ALC-ZKcejR4pdfrfgVqYrG_75zeQ@mail.gmail.com>
	<CAPpHfdv1aXn-oUQNODQ0B6W7JC=t_S1b64V5DAx-HP+KOV-6Lg@mail.gmail.com>
	<88449be3-93e8-4d78-a0d8-c37e4cf26850@app.fastmail.com>
	<CAPpHfduGLJgQERBmQ+=bsr4Oy6F8HCVgQpCYva6=Ncib2X2oUA@mail.gmail.com>
	<8aec133e-5d7f-4fa1-8223-257647dd1ccd@app.fastmail.com>
	<CAPpHfds7M2R0PLGzGa+Y6G+n1z1Na-t5QH2Wsv9iN3n=tcFyEw@mail.gmail.com>
	<432592e4d09341d41bf5cad1df26b3f3@postgrespro.ru>
	<CAPpHfdtmbUOfNWk_ofZyQWd5kztyXhCVmUHYcSr1-JuYO0DyUw@mail.gmail.com>
	<CALj2ACUhgYVHYH5JeNKro1v+SqmDcGyNHn0smWpsQMDLikrN=w@mail.gmail.com>
	<CAPpHfdsV856ca8V=G8DFEViDP7v1hMtDUgOEdBE5dV45a3NKKw@mail.gmail.com>
	<CALj2ACWNKB2fRwaah-jv5stZcisPcwOtsOZdz6+qQWtpG=or8g@mail.gmail.com>
	<CAPpHfdtGh9Gmx-O5qhcSGJmn5z7-yFb7NGqTrM2J94E14w8EOg@mail.gmail.com>
	<87le5wa1dw.fsf@163.com>
	<CAPpHfdv4v-UrS90rSqp8wz9zsWpB7VB5bsPVAoETHWozkDwumA@mail.gmail.com>
	<87h6gk9nvc.fsf@163.com>

On 2024-04-02 11:14, Andy Fan wrote:
> If so, when users call pg_wal_replay_wait, they can get informed when
> the wal is replaied to the target_lsn, but they can't know how long 
> time
> it waits unless they check it in application side, I think such
> information will be useful for monitor purpose sometimes.
> 
> select pg_wal_replay_wait(lsn, 1000);  may just take 1ms in fact, in
> this case, I want this function return 1.

Hi Andy, to get timing we can use \time in psql.
Here is an example.
postgres=# \timing
Timing is on.
postgres=# select 1;
  ?column?
----------
         1
(1 row)

Time: 0.536 ms


>        <returnvalue>void</returnvalue>
And returning VOID is the best option, rather than returning TRUE|FALSE
or timing. It left the logic of the procedure very simple, we get an
error if LSN is not reached.

8 years, we tried to add this feature, and now we suggest the best way
for this feature is to commit the minimal version first.

Let's discuss further improvements in future versions.

-- 
Ivan Kartyshov
Postgres Professional: www.postgrespro.com





view thread (216+ messages)  latest in thread

Message-ID: <6eb8c9f22b075964f502080dadc16cb2@postgrespro.ru>
Permalink:  ../6eb8c9f22b075964f502080dadc16cb2@postgrespro.ru/
Also on:    postgresql.org/message-id/6eb8c9f22b075964f502080dadc16cb2@postgrespro.ru

 · 

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: pgsql-hackers@postgresql.org
  Cc: i.kartyshov@postgrespro.ru, zhihuifan1213@163.com, aekorotkov@gmail.com, bharath.rupireddyforpostgres@gmail.com, euler@eulerto.com, thomas.munro@gmail.com, peter@eisentraut.org, amit.kapila16@gmail.com, dilipbalaut@gmail.com, smithpb2250@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: [HACKERS] make async slave to wait for lsn to be replayed
  In-Reply-To: <6eb8c9f22b075964f502080dadc16cb2@postgrespro.ru>

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

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