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.96) (envelope-from ) id 1wV1cJ-001crp-0a for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Jun 2026 06:31:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wV1cH-005C9u-2H for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Jun 2026 06:31:45 +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.96) (envelope-from ) id 1wV1cH-005C9m-1O for pgsql-bugs@lists.postgresql.org; Thu, 04 Jun 2026 06:31:45 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wV1cF-000000011rK-2usP for pgsql-bugs@lists.postgresql.org; Thu, 04 Jun 2026 06:31:44 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-490b915ded5so2392195e9.3 for ; Wed, 03 Jun 2026 23:31:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1780554702; x=1781159502; darn=lists.postgresql.org; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to; bh=Z1EBwf8QqnBYL/p0naYpORKOqayL350fAUkfg7CvWng=; b=OKy7QMe2AGQwFgXgiWqP1jjDJYAGDFXcyNmGwT14vgTH+VyO4DsN9NnkD18XH8rXGT H93YQ9LGuMWMR3DJ4ROsnpeAdJLb52CbgwzfqclXZ6QqjoivT/NNnZhfzG1MrRshxQbg ctYUXjaitgz/nwjK3JQhDZrnP8aqFn3foRMexyHhnoIqFKXmAA/+Q7TArSktLPvkXfNj kGeffiaHre5Ybb3LXYq9oitbq2cZQm1sQrjHb0pobUq8WZLg53ikhrN6fKQcXoYKhWTi AWb3Je+t0/QKjaD+0vW2xgA5xofp+rWkSudSUm+hwMJ+XGmA0wJuRHtHhEefVBRl9rX/ rotQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780554702; x=1781159502; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Z1EBwf8QqnBYL/p0naYpORKOqayL350fAUkfg7CvWng=; b=jOhgReiTdjZPNmOBSOzyHSKHfLuKFQz1VEmPk1SnMJXY58UEY+G2ungFd4SnOTv5Wo S6GDQzl3C2fBP9aPPkqJbsUSlrjLll3NHlJM5SxTY7007E06ZB31K/rVdqStBvABIHXg lUu6eWiR367+n+fk+LmXa/QtnhPVFifOM8+YETuQd0tpVvR3vI630ouBclpjw7UPshOp RXiwdtca0KjO/mZHlc5G07TtKgVB2l259rZpo98yXIobfdtjV7wI5c8JB1i1TXEZsRpy boBBPkvMFskJFceW+HfLr8JBNUnKJuCtxjcBWYVtcRtX1tfKlphJcgpfoNItOM2WYy1R +cMQ== X-Forwarded-Encrypted: i=1; AFNElJ9vdpPipm1RUQSlvt4yQvguLabltj0W16uwUtjbUsdjcGav4i0zu4PDadDVP36mIfVJJbQosKmL/8Ob@lists.postgresql.org X-Gm-Message-State: AOJu0YwgzVkm0DXSg7dA0B+GhIITpg6190lnrInzWQNNfjtnFdqFZd8F VkjWle6xB1LGJlmZnjbjk8ucb8pTHOujsuX7euXVdBAFa44bRluMNgl34yfJnefNHis= X-Gm-Gg: Acq92OHpaV2rGDXiVuHbrj8N3FnoawTDjHOuLa+twmARnayAruOY3wJoUTo96PCufcB POjZHYSQDJ0sIO1NoYMzk/FI0cS6kv4QRcg2ihLe8lXuZyk2AIbPZGYGisulpq2CfNY0gWBs9mA lf0rcQRMCjtMovjcFPEBu/Yc/QKvsYyFpnNBOnF3BSpXEsxLIWXteH5LJnqQ8l+oThTFDlOqPGt T9neSwwY/UPVd0V3aWuBb/gIKHN/MHikhfD+a+rq7jbs966UhkaTIRp6XZMaznySMcK6yObsCQO /54alzKasNl7ChDlZ0nzV8FVHtM99Z6KMOCdaTd/q2D0xDMQH7XZwOFCxIRIbq8z81m8vDwGNHR PyJO0/Xi+01xO3F7q1H6WgNiSD9zaM9TzaKb1reZE5ohMDg/R1kEURxt5JTt+NNwm0mf5RLfAFJ rka4d2WHsajWsIo7CRcQzOcQ9gmrpktuX5FlHsRfii4EH9laErgc6YIml5HA== X-Received: by 2002:a05:600c:1381:b0:490:a2fd:e1e5 with SMTP id 5b1f17b1804b1-490b60de796mr101069585e9.17.1780554701787; Wed, 03 Jun 2026 23:31:41 -0700 (PDT) Received: from localhost (109-81-168-141.rct.o2.cz. [109.81.168.141]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490bc3e5a00sm47672985e9.15.2026.06.03.23.31.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2026 23:31:41 -0700 (PDT) From: Antonin Houska To: Alvaro Herrera cc: Srinath Reddy Sadipiralla , n.kalinin@postgrespro.ru, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19500: pgrepack logical decoding plugin can crash assert builds via SQL decoding API In-reply-to: References: Comments: In-reply-to Alvaro Herrera message dated "Wed, 03 Jun 2026 23:02:56 +0200." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4413.1780554701.1@localhost> Content-Transfer-Encoding: quoted-printable Date: Thu, 04 Jun 2026 08:31:41 +0200 Message-ID: <4414.1780554701@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera wrote: > On 2026-Jun-03, Antonin Houska wrote: > = > > Srinath Reddy Sadipiralla wrote: > > = > > > Could we reject the pgrepack plugin at slot creation instead, in > > > pg_create_logical_replication_slot() and the CREATE_REPLICATION_SLOT > > > command, so misuse gets a clear "reserved for REPACK (CONCURRENTLY)" > > > error up front, before any decoding? REPACK creates its slot directl= y via > > > ReplicationSlotCreate(), so it's unaffected, and the begin-callback = check > > > with magic guard can stay as the internal safety net. > > > Happy to be told this isn't worth special-casing :) > > = > > Another possible approach: restrict the use of the plugin to the REPAC= K > > decoding worker. > = > I don't like either of these approaches, because they are forcing the > generic facility (either slot creation or logical decoding setup) to > know something about one specific user of the facility. That is to say, > the restriction is being added on the wrong side of the abstraction. > I know my implementation the drawback you (Srinath) mentioned, because > the abstraction doesn't provide us with a great way to inject an error > report at the exact spot we need it; but I think it's at the correct > side of the abstraction. I noticed that ReplicationSlotAcquire() already does something like that /* * Do not allow users to acquire the reserved slot. This scenario may * occur if the launcher that owns the slot has terminated unexpectedl= y * due to an error, and a backend process attempts to reuse the slot. */ if (!IsLogicalLauncher() && IsSlotForConflictCheck(name)) ereport(ERROR, errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("cannot acquire replication slot \"%s\"", name), errdetail("The slot is reserved for conflict detection and can only b= e acquired by logical replication launcher.")); but I agree that it's not perfect to hard-wire particular slot names into functions like this. Perhaps we could introduce a concept of "reserved slo= ts" and an API (callback) to perform these checks, but that's not appropriate = for beta release. > (I'm not really sure that there _is_ a great way to throw an error > report at the right time. That would require every single output plugin > author to add a function we can call; and every single one of them, > except REPACK, would do nothing. This seems quite pointless.) > = > I frankly don't have a problem with letting a transaction spill a few > GBs to disk only to then report an error that pgrepack is being misused. > It's just not something that anyone would do for fun. I admit that the possibility of wasted processing of a transaction didn't really frighten me. The idea I posted just occurred to me somehow, but I d= on't consider it urgent. I'm fine with your approach. -- = Antonin Houska Web: https://www.cybertec-postgresql.com