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 1t80cd-001ThN-CB for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Nov 2024 17:12:10 +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 1t80cZ-003QwN-Uv for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Nov 2024 17:12:08 +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 1t80cZ-003QwF-Hr for pgsql-hackers@lists.postgresql.org; Mon, 04 Nov 2024 17:12:08 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t80cW-000A6L-Lg for pgsql-hackers@postgresql.org; Mon, 04 Nov 2024 17:12:06 +0000 Received: from [192.168.1.110] (dsl-hkibng22-50ddb7-241.dhcp.inet.fi [80.221.183.241]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4Xhygd6L73z49QHB; Mon, 4 Nov 2024 19:11:57 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1730740320; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lGXPF2mMAeObKBlVhQO1n1I2b0ufT2+DjaclbW7BXnw=; b=NryhkzchLi2UBgxdd+2l7LHZa/06KnfKVxNBsbk3eazT0AdI9qbK5hGYARFwzDqjrG7oFR Zl0Bivi83H/Y2+eEog9QFAIhK0qZLCM//C7u6kLMwqL/kcfVTYI8TAQKVUVroMj6wZIXQl dyq4hVGWPtE7pDzZmFs32aHw7SxZ4OpHMvAeJXvoD/4hnIcXyM10ywzu4TkBb0WcD32XDq r/ytGYKS1edQW1pLhXk0hk86JKabHPwfsPJcIGlNwqB9DCStpI+9kksOJQwuwD51BPE2E2 dfVJMt6LR+GeiOx8QY9JOk9x9BDvd/u+jhIIoPy7GrRcNF6ZdqPINYZ+rZo+KQ== ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1730740320; a=rsa-sha256; cv=none; b=sn802nwD00V4991xYfR2G/ylwfgxgNhVRfEBnq0fKQY0ZnhL9SBrnSjDtk3WxlCUgc7ZEd h8rYo0Egc0qJFxY/sZQbGRrvRg3FSmFmvmFgX9VY7INpl2YiaUsDXigDczxsT5/oqTI+Rl H1Q5poUkS0vn71d+CdwwwpPCLhoOYpTC+F9gTjGCPVERECBnk5cVv/MVL7fEzOL2UMSZSV dRKw4BndorwABD7eNV3N7wznavfVoQf+r0AwYuPdnXL8Fyr/Fqs0d4ZCy+cKhGDEDfgO5g DPWPQhFnWvpKHMfbXQH43H06qzdnYlKB/u4szmnPQkgzLd7WwVC65b3BcE1FYQ== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1730740320; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lGXPF2mMAeObKBlVhQO1n1I2b0ufT2+DjaclbW7BXnw=; b=oS5K4zr1869osvcQBWMQ6yfEQEWgi3uSm8NgpvRaKhUTaNimoUShLAfORyC9RNfXYptlH8 +I8+g00Mmg4r5fyV55B6r5Wo4/xiwydDTx45kjwMUqdj4x8ms6knw5GeMNByy1Eyf+o3b+ rN9EiOEW4uZqShIegE46vYeSholnJDNhYO9ys+d1hdwC4SmL9CYt4hT2ycINeg2/X9Cx+8 vhcWAtpbCOo09lWcpesnei8l36KvSfMGcuUCPAbs48OyYDpKDXRilBZjvqClUlyjFNEohh nU3UkG8sZ3aHELn/kgbe0EwVYCHrOlzioIWDCXN+Mar+280BNzUa9sFfHMcAkA== Message-ID: Date: Mon, 4 Nov 2024 19:11:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pgsql: Implement pg_wal_replay_wait() stored procedure To: Robert Haas Cc: Alvaro Herrera , Alexander Korotkov , Michael Paquier , Pavel Borisov , Peter Eisentraut , pgsql-hackers References: <202411041419.qif3lqaisktw@alvherre.pgsql> <8d60e621-e971-458e-9e20-f5902c8c852a@iki.fi> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 04/11/2024 18:53, Robert Haas wrote: > On Mon, Nov 4, 2024 at 10:57 AM Heikki Linnakangas wrote: >>> Maybe that's just a better fit and we don't need either a procedure >>> or new syntax. >> I think it would still be good to expose the feature at SQL level too. >> Makes it easier to test and makes it usable without client library >> changes, for example. > > OK. Well then I agree with Álvaro. If using a procedure isn't working > out nicely, it's better to consider alternatives than to force a round > peg into a square hole (with due regard for the fact that you can fit > anything through the square hole if you make the square hole big > enough...). Agreed. Off the top of my, summary of issues I'm aware of: - Missing documentation. The function itself is documented, but it's clearly intended for implementing read-after-write consistency in a cluster setup, so we should document how to do that. - Not clear to me what the use case for the 'timeout' and 'noerror' arguments is. Why do we need it at all? (See first point on missing docs). - Separate pg_wal_replay_wait_status() function to get result status is awkward - Inconsistencies in behavior if server is not in recovery (Alexander's latest patch addresses this, but I didn't review it yet) - pg_wal_replay_wait_status() is incorrectly marked as STABLE and PARALLEL SAFE - Broken with default_transaction_isolation ='repeatable read' Let's revert commit e546989a26 and rethink. I think the basic pg_wal_replay_wait() interface before e546989a26 was fine. Some of the above are issues above were present before e546989a26 already and need to be addressed in any case, but I believe they can be fixed without changing the interface. -- Heikki Linnakangas Neon (https://neon.tech)