Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rrZOS-001MmH-Cz for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Apr 2024 08:21:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rrZOQ-0067XR-7m for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Apr 2024 08:21:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rrZOP-0067XI-UR for pgsql-hackers@lists.postgresql.org; Tue, 02 Apr 2024 08:21:18 +0000 Received: from m16.mail.163.com ([220.197.31.5]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rrZOL-0006n6-3O for pgsql-hackers@lists.postgresql.org; Tue, 02 Apr 2024 08:21:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=cRTdwOoAkUq9ZR8m236uQjfqJ0WTVsUNcAc6i9MS37A=; b=o4tzXY6EhO30luHjZEYF2/uHarV0FJJ3bBGhyUuw4iM/ZrqTVpc7aaJaKgrdzV iFm1YhuD4LweK9Xca5EjuXcjqPhWWvVrFT3gHZGPWYgrGuuX1rYwHJROVeEiYIje 4XPFIXYApr0fnF2//vWp0m5TUq1POiONrQSgSpGDoUZZI= Received: from 8235eee8a2a0 (unknown [140.205.118.169]) by gzga-smtp-mta-g1-0 (Coremail) with SMTP id _____wD3O6jovwtmKiphCQ--.2688S3; Tue, 02 Apr 2024 16:20:56 +0800 (CST) References: <5358d911a08ef2952b1e9f74062426ee@postgrespro.ru> <88449be3-93e8-4d78-a0d8-c37e4cf26850@app.fastmail.com> <8aec133e-5d7f-4fa1-8223-257647dd1ccd@app.fastmail.com> <432592e4d09341d41bf5cad1df26b3f3@postgrespro.ru> <87le5wa1dw.fsf@163.com> User-agent: mu4e 1.10.7; emacs 29.1 From: Andy Fan To: Alexander Korotkov Cc: Bharath Rupireddy , Kartyshov Ivan , Euler Taveira , Thomas Munro , Peter Eisentraut , Amit Kapila , Dilip Kumar , Peter Smith , pgsql-hackers@lists.postgresql.org Subject: Re: [HACKERS] make async slave to wait for lsn to be replayed Date: Tue, 02 Apr 2024 16:14:49 +0800 In-reply-to: Message-ID: <87h6gk9nvc.fsf@163.com> MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID: _____wD3O6jovwtmKiphCQ--.2688S3 X-Coremail-Antispam: 1Uf129KBjvJXoWrZFy5Kw4DZw1rKrWxAF45GFg_yoW8Jrykpr WftryDJrWkW34UJ3Wqkws3Xr1fZrW3GrnxZrZ8tr92vr45trZ2yanrKw1Y9rn5WryrGa15 XanFva1fCan8A3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07U5nYwUUUUU= X-Originating-IP: [140.205.118.169] X-CM-SenderInfo: x2klx3xlid0iqsrtqiywtou0bp/1tbiNgq0U2XAk0VezgAAs4 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Alexander! >> + >> + pg_wal_replay_wait ( >> + target_lsn pg_lsn, >> + timeout bigint DEFAULT 0) >> + void >> + >> >> Should we return the millseconds of waiting time? I think this >> information may be useful for customer if they want to know how long >> time it waits for for minitor purpose. > > Please, check it more carefully. In v17 timeout is in integer milliseconds. I guess one of us misunderstand the other:( and I do didn't check the code very carefully. Acutally I meant the "return value" rather than function argument. IIUC the current return value is void per below statement. >> + void 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. -- Best Regards Andy Fan