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 1t67GY-00AkV4-Rd for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Oct 2024 11:53:34 +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 1t67GV-008CPY-Uj for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Oct 2024 11:53:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t67GV-008COy-Kn for pgsql-hackers@lists.postgresql.org; Wed, 30 Oct 2024 11:53:32 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t67GT-003oTe-Vz; Wed, 30 Oct 2024 11:53:31 +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 4XdlrS2Y3Kz49Q3N; Wed, 30 Oct 2024 13:53:28 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1730289208; 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=6Rhy3vzOrOoP89tNAJDs68SOzWVDLQOLUZXuw0Ovtcs=; b=hDo0VaIV2MFOBQk4Kney6YRfbrf2U3eG+iYYlZYrS0ry3rPEfWFHYkZQfORA/a/3cJaK7C 8PEa3BU57EoSfYLk5J3huy9a0QTL3GTUbmfw+LJ10fkbPdCq589j8g0k/Z7/XE/a+W9d6b mXH40LElCOoqde4XG5YrWaLXlUZsOvOgPJJltOvm4QQFmyBlcf6/A0oNaI89s93bBlEVnF 4pPLyMaF+EZuBELdXg6n6DiwZvzPCbvWW5m0oYIU0SbhPAJ4FEoCCPnY5AHOuN0ecaS2Yq 6tP48JzECCJ0kHkkM4T0tnXB+qElvzMo1Ftdjg7gfMKmsrUttxXXUxUkU9A8dA== ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1730289208; a=rsa-sha256; cv=none; b=L0L8GdrgNhhspFpE2Vglh+H5ABCHafR+br/XMzySi2VhIMqNA6DPPWOv+AzmsP/ASVora+ bUYhFnQsMXygxSm+1xZORPoipv3ULP9wNamOr69nS0I4JyeRzgMCISp2I4NZDrGNmxlAWZ eJ2JLS+6cNdVDGALgF1ImvRf8S9x1U6iMLroLM8ZuAzND2A2ISXBFizcmp3FwdUhWady9H pJ44T56Bt8fVm8BRWDLOFbSVI33YvEZl0zaPy4OOsD1sAfJQoUsT3tOaur1wCzLmMm+6H/ YyBCMFMzJxvIORAyCpJoZtz+KLrk7hdAUjRS3oZGl2d2oK9NmCH1Uc8OGTKAGg== 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=1730289208; 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=6Rhy3vzOrOoP89tNAJDs68SOzWVDLQOLUZXuw0Ovtcs=; b=WqJXJLyNxSKjjVGFKeJ4UoWKuaJ/BF8zVy09W2sh6u3H5KpEhBPmW8Z2xhKcl47mDcapvt yprjQcBbiWliDJq/5ZXAQEmP6Usmc+x5Kl5JkfKcCXVfbzTbWcFVd3eYPWUb6dKTyjcvt/ NknU02navH0H//7shfjrbDmemD4OPfv/Hkz7KHKxryBvftNTAK/MRiLEW38EGFktIdyWX3 /hl/mq0Awojoj7XFj5HzbVH2Ulj5JsAwbQRmuKyKB4Qkti5zwmM535c5UymJbBwhOYFDiw 0ZW/DIuLFZ2QiGOmfZ44PwDuqIsI4mV/ZrzaW8T9hnORMFUaEgCuXPouuHgBmA== Message-ID: <1418b1ef-aa2c-490c-affe-fe288b7746c8@iki.fi> Date: Wed, 30 Oct 2024 13:53:27 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: protocol-level wait-for-LSN To: Tatsuo Ishii , postgres@jeltef.nl Cc: peter@eisentraut.org, pgsql-hackers@postgresql.org References: <20241030.154919.859856957033404666.ishii@postgresql.org> <20241030.203455.1272396392870662989.ishii@postgresql.org> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: <20241030.203455.1272396392870662989.ishii@postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 30/10/2024 13:34, Tatsuo Ishii wrote: >> On Wed, 30 Oct 2024 at 07:49, Tatsuo Ishii wrote: >>>> I think one would have to define that somehow. If it's useful, the >>>> additional fields of both extensions could be appended, in some >>>> defined order. But this is an interesting question to think about. >>> >>> I think this kind of extension, which adds new filed to an existing >>> message type, should be implemented as v4 protocol. >> >> Could you explain why you think a major version bump is needed? In >> what situation do you care about this. Because for my usecases (client >> implementations & pgbouncer) I don't think that would be necessary. If >> a client doesn't send the _pq_.wait_for_lsn protocol parameter, it >> will never receive this new version. > > Yes, if there's only one extension for a message type, it would not be > a big problem. But if there's more than one extensions that want to > change the same type, problem arises as I have already discussed them > upthread. > >> I don't really see a problem with having two protocol parameters >> change the same message. Yes, you have to define what the result of >> their combination is, but that seems trivial to do for additions of >> fields. You either define the first protocol parameter that was added >> to the spec, to add its field before the second. Or you could do it >> based on something non-time-dependent, like the alphabetic order of >> the protocol parameter, or the alphabetic order of the fields that >> they add. > > That sounds far from trivial. So each extension needs to check if any > other extension which modifies the same message type is activated? > That requires each extension implementation to have built-in knowledge > about any conflicting extension. Moreover each extension may not be > added at once. If extension Y is added after extension X is defined, > then implementation of X needs to be changed because at the time when > X is defined, it did not need to care about Y. Another way to deal > with the problem could be defining a new protocol message which > describes those conflict information so that each extensions do not > need to have such information built-in, but maybe it is too complex. Note that the "protocol extension" mechanism is *not* meant for user-defined extensions. That's not the primary purpose anyway. It allows evolving the protocol in core code in a backwards compatible way, but indeed the different extensions will need to be coordinated so that they don't clash with each other. If they introduced new message types for example, they better use different message type codes. We might have made a mistake by calling this mechanism "protocol extensions", because it makes people think of user-defined extensions. With user-defined extensions, yes, you have exactly the problem you describe.We have no rules on how a protocol extension is allowed to change the protocol. It might add fields, it might add messages, or it might change the meaning of existing messages. Or encapsulate the whole protocol in XML. So yes, each protocol extension needs to know about all the other protocol extensions that it can be used with. In practice we'll avoid doing crazy stuff so that the protocol extensions are orthogonal, but if user-defined extensions get involved, there's not much we can do to ensure that. -- Heikki Linnakangas Neon (https://neon.tech)